Here are the examples of the csharp api class System.Data.Common.CommandTrees.DbExpression.IsOf(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
0
1. Example
View licenseprotected override DbExpression TypedTranslate(ExpressionConverter parent, TypeBinaryExpression linq) { DbExpression operand = parent.TranslateExpression(linq.Expression); TypeUsage fromType = operand.ResultType; TypeUsage toType = parent.GetIsOrAsTargetType(fromType, ExpressionType.TypeIs, linq.TypeOperand, linq.Expression.Type); return operand.IsOf(toType); }
0
2. Example
View licensepublic override DbExpression Visit(IsOfOp op, Node n) { // Direct conversion to DbIsOfExpression (with DbExpressionKind.IsOf) with the same Type and converted argument DbExpression if (op.IsOfOnly) return VisitChild(n, 0).IsOfOnly(op.IsOfType); else return VisitChild(n, 0).IsOf(op.IsOfType); }
0
3. Example
View licenseprivate DbFilterExpression CreateIsOfFilterExpression(DbExpression input, IsOfFilter typeFilter) { // Create a filter expression based on the IsOf/IsOfOnly operations specified by typeFilter DbExpressionBinding resultBinding = input.Bind(); List<DbExpression> predicates = new List<DbExpression>( typeFilter.ToEnumerable().Select(tf => tf.Value ? resultBinding.Variable.IsOfOnly(tf.Key) : resultBinding.Variable.IsOf(tf.Key)).ToList() ); DbExpression predicate = Helpers.BuildBalancedTreeInPlace(predicates, (left, right) => left.And(right)); DbFilterExpression result = resultBinding.Filter(predicate); // Track the fact that this IsOfFilter was created by the ITreeGenerator itself and should // simply be converted to an ITree Node when it is encountered again by the visitor pass. _processedIsOfFilters.Add(result); return result; }
0
4. Example
View licenseinternal 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; }
0
5. Example
View licenseprivate static Dictionary<AST.BuiltInKind, BuiltInExprConverter> CreateBuiltInExprConverter() /n ..... /n //View Source file for more details /n }