1: [Serializable]
2: public class FunctionExpression : Expression
3: {
4: #region class member declarations
5: private string _functionToApply;
6: #endregion
7:
8: public FunctionExpression()
9: : base()
10: {
11: _functionToApply = string.Empty;
12: }
13:
14: /// Selfservicing constructor.All other constructors are hidden, we only work on a single field.
15: public FunctionExpression(IEntityField field, string functionToApply)
16: : base(field)
17: {
18: _functionToApply = functionToApply;
19: }
20:
21: /// Adapter constructor. All other constructors are hidden, we only work on a single field.
22: public FunctionExpression(IEntityField2 field, string functionToApply)
23: : base(field)
24: {
25: _functionToApply = functionToApply;
26: }
27:
28:
29: public override string ToQueryText(ref int uniqueMarker, bool inHavingClause)
30: {
31: if (_functionToApply.Length > 0)
32: {
33: return string.Format("{0}({1})", _functionToApply, base.ToQueryText(ref uniqueMarker, inHavingClause));
34: }
35: else
36: {
37: return base.ToQueryText(ref uniqueMarker, inHavingClause);
38: }
39: }
40:
41:
42: #region properties
43: public string FunctionToApply
44: {
45: get { return _functionToApply; }
46: set { _functionToApply = value; }
47: }
48: #endregion
49: }