System.Data.Common.CommandTrees.DbExpression.Deref()

Here are the examples of the csharp api class System.Data.Common.CommandTrees.DbExpression.Deref() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: referencesource
Source File: TypeRestriction.cs
View license
internal override DbExpression AsCqt(DbExpression row, bool skipIsNotNull)
        {
            DbExpression cqt = this.RestrictedMemberSlot.MemberPath.AsCqt(row);

            if (Helper.IsRefType(this.RestrictedMemberSlot.MemberPath.EdmType))
            {
                cqt = cqt.Deref();
            }

            if (this.Domain.Count == 1)
            {
                // Single value
                cqt = cqt.IsOfOnly(TypeUsage.Create(((TypeConstant)this.Domain.Values.Single()).EdmType));
            }
            else
            {
                // Multiple values: build list of var IsOnOnly(t1), var = IsOnOnly(t1), ..., then OR them all.
                List<DbExpression> operands = this.Domain.Values.Select(t => (DbExpression)cqt.IsOfOnly(TypeUsage.Create(((TypeConstant)t).EdmType))).ToList();
                cqt = Helpers.BuildBalancedTreeInPlace(operands, (prev, next) => prev.Or(next));
            }

            return cqt;
        }

2. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
View license
private static ExpressionResolution ConvertDeRefExpr(AST.Node astExpr, SemanticResolver sr)
        {
            AST.DerefExpr deRefExpr = (AST.DerefExpr)astExpr;

            DbExpression converted = null;

            converted = ConvertValueExpression(deRefExpr.ArgExpr, sr);

            //
            // check if return type is RefType
            //
            if (!TypeSemantics.IsReferenceType(converted.ResultType))
            {
                throw EntityUtil.EntitySqlError(deRefExpr.ArgExpr.ErrCtx, Strings.DeRefArgIsNotOfRefType(converted.ResultType.EdmType.FullName));
            }

            //
            // create DeRef expression
            //
            converted = converted.Deref();
            Debug.Assert(null != converted, "null != converted");

            return new ValueExpression(converted);
        }

3. Example

Project: referencesource
Source File: SemanticResolver.cs
View license
private bool TryResolveAsRefPropertyAccess(DbExpression valueExpr, string name, ErrorContext errCtx, out DbExpression propertyExpr)
        {
            Debug.Assert(valueExpr != null, "valueExpr != null");

            propertyExpr = null;

            if (TypeSemantics.IsReferenceType(valueExpr.ResultType))
            {
                DbExpression derefExpr = valueExpr.Deref();
                TypeUsage derefExprType = derefExpr.ResultType;

                if (TryResolveAsPropertyAccess(derefExpr, name, errCtx, out propertyExpr))
                {
                    return true;
                }
                else
                {
                    throw EntityUtil.EntitySqlError(errCtx, Strings.InvalidDeRefProperty(name, derefExprType.EdmType.FullName, valueExpr.ResultType.EdmType.FullName));
                }
            }

            return false;
        }