Mercurial > pub > bltoolkit
comparison Source/Data/Linq/SqlExpressionAttribute.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f990fcb411a9 |
---|---|
1 using System; | |
2 using System.Reflection; | |
3 | |
4 namespace BLToolkit.Data.Linq | |
5 { | |
6 using Data.Sql; | |
7 using Reflection; | |
8 | |
9 [SerializableAttribute] | |
10 [AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] | |
11 public class SqlExpressionAttribute : SqlFunctionAttribute | |
12 { | |
13 public SqlExpressionAttribute(string expression) | |
14 : base(expression) | |
15 { | |
16 Precedence = Data.Sql.Precedence.Primary; | |
17 } | |
18 | |
19 public SqlExpressionAttribute(string expression, params int[] argIndices) | |
20 : base(expression, argIndices) | |
21 { | |
22 Precedence = Data.Sql.Precedence.Primary; | |
23 } | |
24 | |
25 public SqlExpressionAttribute(string sqlProvider, string expression) | |
26 : base(sqlProvider, expression) | |
27 { | |
28 Precedence = Data.Sql.Precedence.Primary; | |
29 } | |
30 | |
31 public SqlExpressionAttribute(string sqlProvider, string expression, params int[] argIndices) | |
32 : base(sqlProvider, expression, argIndices) | |
33 { | |
34 Precedence = Data.Sql.Precedence.Primary; | |
35 } | |
36 | |
37 protected new string Name | |
38 { | |
39 get { return base.Name; } | |
40 } | |
41 | |
42 public string Expression | |
43 { | |
44 get { return base.Name; } | |
45 set { base.Name = value; } | |
46 } | |
47 | |
48 public int Precedence { get; set; } | |
49 | |
50 public override ISqlExpression GetExpression(MemberInfo member, params ISqlExpression[] args) | |
51 { | |
52 return new SqlExpression(TypeHelper.GetMemberType(member), Expression ?? member.Name, Precedence, ConvertArgs(member, args)); | |
53 } | |
54 } | |
55 } |