本文整理汇总了C#中System.Data.Linq.Provider.NodeTypes.SqlExpression类的典型用法代码示例。如果您正苦于以下问题:C# SqlExpression类的具体用法?C# SqlExpression怎么用?C# SqlExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlExpression类属于System.Data.Linq.Provider.NodeTypes命名空间,在下文中一共展示了SqlExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlJoin
internal SqlJoin(SqlJoinType type, SqlSource left, SqlSource right, SqlExpression cond, Expression sourceExpression)
: base(SqlNodeType.Join, sourceExpression) {
this.JoinType = type;
this.Left = left;
this.Right = right;
this.Condition = cond;
}
示例2: SqlMemberAssign
internal SqlMemberAssign(MemberInfo member, SqlExpression expr)
: base(SqlNodeType.MemberAssign, expr.SourceExpression) {
if (member == null)
throw Error.ArgumentNull("member");
this.member = member;
this.Expression = expr;
}
示例3: SqlUnary
internal SqlUnary(SqlNodeType nt, Type clrType, ProviderType sqlType, SqlExpression expr, MethodInfo method, Expression sourceExpression)
: base(nt, clrType, sqlType, sourceExpression) {
switch (nt) {
case SqlNodeType.Not:
case SqlNodeType.Not2V:
case SqlNodeType.Negate:
case SqlNodeType.BitNot:
case SqlNodeType.IsNull:
case SqlNodeType.IsNotNull:
case SqlNodeType.Count:
case SqlNodeType.LongCount:
case SqlNodeType.Max:
case SqlNodeType.Min:
case SqlNodeType.Sum:
case SqlNodeType.Avg:
case SqlNodeType.Stddev:
case SqlNodeType.Convert:
case SqlNodeType.ValueOf:
case SqlNodeType.Treat:
case SqlNodeType.OuterJoinedValue:
case SqlNodeType.ClrLength:
break;
default:
throw Error.UnexpectedNode(nt);
}
this.Operand = expr;
this.method = method;
}
示例4: CheckJoinCondition
private void CheckJoinCondition(SqlExpression expr)
{
switch(expr.NodeType)
{
case SqlNodeType.And:
{
SqlBinary b = (SqlBinary)expr;
CheckJoinCondition(b.Left);
CheckJoinCondition(b.Right);
break;
}
case SqlNodeType.EQ:
case SqlNodeType.EQ2V:
{
SqlBinary b = (SqlBinary)expr;
SqlColumnRef crLeft = b.Left as SqlColumnRef;
SqlColumnRef crRight = b.Right as SqlColumnRef;
if(crLeft != null && crRight != null)
{
SqlColumn cLeft = crLeft.GetRootColumn();
SqlColumn cRight = crRight.GetRootColumn();
this._map[cLeft] = cRight;
this._map[cRight] = cLeft;
}
break;
}
}
}
示例5: SqlBinary
internal SqlBinary(SqlNodeType nt, Type clrType, ProviderType sqlType, SqlExpression left, SqlExpression right, MethodInfo method)
: base(nt, clrType, sqlType, right.SourceExpression) {
switch (nt) {
case SqlNodeType.Add:
case SqlNodeType.Sub:
case SqlNodeType.Mul:
case SqlNodeType.Div:
case SqlNodeType.Mod:
case SqlNodeType.BitAnd:
case SqlNodeType.BitOr:
case SqlNodeType.BitXor:
case SqlNodeType.And:
case SqlNodeType.Or:
case SqlNodeType.GE:
case SqlNodeType.GT:
case SqlNodeType.LE:
case SqlNodeType.LT:
case SqlNodeType.EQ:
case SqlNodeType.NE:
case SqlNodeType.EQ2V:
case SqlNodeType.NE2V:
case SqlNodeType.Concat:
case SqlNodeType.Coalesce:
break;
default:
throw Error.UnexpectedNode(nt);
}
this.Left = left;
this.Right = right;
this.method = method;
}
示例6: SqlGrouping
internal SqlGrouping(Type clrType, ProviderType sqlType, SqlExpression key, SqlExpression group, Expression sourceExpression)
: base(SqlNodeType.Grouping, clrType, sqlType, sourceExpression) {
if (key == null) throw Error.ArgumentNull("key");
if (group == null) throw Error.ArgumentNull("group");
this.key = key;
this.group = group;
}
示例7: SqlWhen
internal SqlWhen(SqlExpression match, SqlExpression value) {
// 'match' may be null when this when represents the ELSE condition.
if (value == null)
throw Error.ArgumentNull("value");
this.Match = match;
this.Value = value;
}
示例8: AddTimeSpan
internal override SqlExpression AddTimeSpan(SqlExpression dateTime, SqlExpression timeSpan, bool asNullable)
{
Debug.Assert(this.IsHighPrecisionDateTimeType(timeSpan));
SqlExpression ns = FunctionCallDatePart("NANOSECOND", timeSpan);
SqlExpression ms = FunctionCallDatePart("MILLISECOND", timeSpan);
SqlExpression ss = FunctionCallDatePart("SECOND", timeSpan);
SqlExpression mi = FunctionCallDatePart("MINUTE", timeSpan);
SqlExpression hh = FunctionCallDatePart("HOUR", timeSpan);
SqlExpression result = dateTime;
if(this.IsHighPrecisionDateTimeType(dateTime))
{
result = FunctionCallDateAdd("NANOSECOND", ns, result, dateTime.SourceExpression, asNullable);
}
else
{
result = FunctionCallDateAdd("MILLISECOND", ms, result, dateTime.SourceExpression, asNullable);
}
result = FunctionCallDateAdd("SECOND", ss, result, dateTime.SourceExpression, asNullable);
result = FunctionCallDateAdd("MINUTE", mi, result, dateTime.SourceExpression, asNullable);
result = FunctionCallDateAdd("HOUR", hh, result, dateTime.SourceExpression, asNullable);
if(this.IsDateTimeOffsetType(dateTime))
return ConvertTo(typeof(DateTimeOffset), result);
return result;
}
示例9: SqlUserQuery
internal SqlUserQuery(string queryText, SqlExpression projection, IEnumerable<SqlExpression> args, Expression source)
: base(SqlNodeType.UserQuery, source) {
this.queryText = queryText;
this.Projection = projection;
this.args = (args != null) ? new List<SqlExpression>(args) : new List<SqlExpression>();
this.columns = new List<SqlUserColumn>();
}
示例10: Visit
internal override SqlNode Visit(SqlNode node) {
if (node == null)
return null;
sourceExpression = node as SqlExpression;
if (sourceExpression != null) {
Type type = sourceExpression.ClrType;
UnwrapStack unwrap = this.UnwrapSequences;
while (unwrap != null) {
if (unwrap.Unwrap) {
type = TypeSystem.GetElementType(type);
}
unwrap = unwrap.Last;
}
sourceType = type;
}
if (sourceType != null && TypeSystem.GetNonNullableType(sourceType).IsValueType) {
return node; // Value types can't also have a dynamic type.
}
if (sourceType != null && TypeSystem.HasIEnumerable(sourceType)) {
return node; // Sequences can't be polymorphic.
}
switch (node.NodeType) {
case SqlNodeType.ScalarSubSelect:
case SqlNodeType.Multiset:
case SqlNodeType.Element:
case SqlNodeType.SearchedCase:
case SqlNodeType.ClientCase:
case SqlNodeType.SimpleCase:
case SqlNodeType.Member:
case SqlNodeType.DiscriminatedType:
case SqlNodeType.New:
case SqlNodeType.FunctionCall:
case SqlNodeType.MethodCall:
case SqlNodeType.Convert: // Object identity does not survive convert. It does survive Cast.
// Dig no further.
return node;
case SqlNodeType.TypeCase:
sourceType = ((SqlTypeCase)node).RowType.Type;
return node;
case SqlNodeType.Link:
sourceType = ((SqlLink)node).RowType.Type;
return node;
case SqlNodeType.Table:
sourceType = ((SqlTable)node).RowType.Type;
return node;
case SqlNodeType.Value:
SqlValue val = (SqlValue)node;
if (val.Value != null) {
// In some cases the ClrType of a Value node may
// differ from the actual runtime type of the value.
// Therefore, we ensure here that the correct type is set.
sourceType = val.Value.GetType();
}
return node;
}
return base.Visit(node);
}
示例11: GetLiteralValue
private SqlValue GetLiteralValue(SqlExpression expr)
{
while(expr != null && expr.NodeType == SqlNodeType.ColumnRef)
{
expr = ((SqlColumnRef)expr).Column.Expression;
}
return expr as SqlValue;
}
示例12: AddFactory
internal void AddFactory(Type elementType, Type dataReaderType, object mapping, DataLoadOptions options, SqlExpression projection, IObjectReaderFactory factory)
{
this.list.AddFirst(new LinkedListNode<CacheInfo>(new CacheInfo(elementType, dataReaderType, mapping, options, projection, factory)));
if(this.list.Count > this.maxCacheSize)
{
this.list.RemoveLast();
}
}
示例13: CacheInfo
public CacheInfo(Type elementType, Type dataReaderType, object mapping, DataLoadOptions options, SqlExpression projection, IObjectReaderFactory factory)
{
this.elementType = elementType;
this.dataReaderType = dataReaderType;
this.options = options;
this.mapping = mapping;
this.projection = projection;
this.factory = factory;
}
示例14: SqlClientCase
internal SqlClientCase(Type clrType, SqlExpression expr, IEnumerable<SqlClientWhen> whens, Expression sourceExpression)
: base(SqlNodeType.ClientCase, clrType, sourceExpression) {
this.Expression = expr;
if (whens == null)
throw Error.ArgumentNull("whens");
this.whens.AddRange(whens);
if (this.whens.Count == 0)
throw Error.ArgumentOutOfRange("whens");
}
示例15: SqlSelect
internal SqlSelect(SqlExpression selection, SqlSource from, Expression sourceExpression)
: base(SqlNodeType.Select, sourceExpression) {
this.Row = new SqlRow(sourceExpression);
this.Selection = selection;
this.From = from;
this.groupBy = new List<SqlExpression>();
this.orderBy = new List<SqlOrderExpression>();
this.orderingType = SqlOrderingType.Default;
}