System.Data.Common.CommandTrees.DbExpression.TreatAs(System.Data.Metadata.Edm.TypeUsage)

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

5 Examples 7

1. Example

Project: referencesource
Source File: Translator.cs
protected override DbExpression TranslateUnary(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression unary, DbExpression operand)
            {
                TypeUsage fromType = operand.ResultType;
                TypeUsage toType = parent.GetIsOrAsTargetType(fromType, ExpressionType.TypeAs, unary.Type, unary.Operand.Type);
                return operand.TreatAs(toType);
            }

2. Example

Project: referencesource
Source File: MemberPath.cs
internal DbExpression AsCqt(DbExpression row)
        {
            DbExpression cqt = row;

            // Process all items in the path.
            AsCql(
                // accessMember action
                (memberName) =>
                {
                    cqt = DbExpressionBuilder.Property(cqt, memberName);
                },
                // getKey action
                () =>
                {
                    cqt = cqt.GetRefKey();
                },
                // treatAs action
                (treatAsType) =>
                {
                    var typeUsage = TypeUsage.Create(treatAsType);
                    cqt = cqt.TreatAs(typeUsage);
                });

            return cqt;
        }

3. Example

Project: referencesource
Source File: OrderByLifter.cs
internal virtual DbExpression OfType(TypeUsage type)
                {
                    // s.OfType<T> is normally translated to s.Filter(e => e is T).Project(e => e as T)
                    DbExpressionBinding rootBinding = _root.BindAs(_aliasGenerator.Next());
                    DbExpression filter = this.Filter(rootBinding.Filter(rootBinding.Variable.IsOf(type)));
                    OrderByLifterBase filterLifter = GetLifter(filter, _aliasGenerator);
                    DbExpressionBinding filterBinding = filter.BindAs(_aliasGenerator.Next());
                    DbExpression project = filterLifter.Project(filterBinding.Project(filterBinding.Variable.TreatAs(type)));
                    return project;
                }

4. Example

Project: referencesource
Source File: ITreeGenerator.cs
private DbExpression ApplyIsOfFilter(DbExpression current, IsOfFilter typeFilter)
        {
        /n ..... /n //View Source file for more details /n }

5. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
private static Dictionary<AST.BuiltInKind, BuiltInExprConverter> CreateBuiltInExprConverter()
/n ..... /n //View Source file for more details /n }