Here are the examples of the csharp api class System.Data.Common.CommandTrees.DbExpression.CastTo(System.Data.Metadata.Edm.TypeUsage) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
11 Examples
0
1. Example
View licenseprotected virtual CqtExpression WrapNonCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType) { if (!TypeUsageEquals(returnType, operand.ResultType)) { operand = operand.CastTo(returnType); } return operand; }
0
2. Example
View licenseinternal override DbExpression AsCqt(DbExpression row, MemberPath outputMember) { DbExpression cqt = m_memberPath.AsCqt(row); TypeUsage outputMemberTypeUsage; if (NeedToCastCqlValue(outputMember, out outputMemberTypeUsage)) { cqt = cqt.CastTo(outputMemberTypeUsage); } return cqt; }
0
3. Example
View licenseprivate DbExpression GenerateScalarPropertyMappingView(EdmProperty edmProperty, EdmProperty columnProperty, DbExpression row) { DbExpression accessorExpr = GenerateColumnRef(row, columnProperty); if (!TypeSemantics.IsEqual(accessorExpr.ResultType, edmProperty.TypeUsage)) { accessorExpr = accessorExpr.CastTo(edmProperty.TypeUsage); } return accessorExpr; }
0
4. Example
View licenseprivate DbExpression AlignTypes(DbExpression cqt, Type toClrType) { Type fromClrType = null; // not used in this code path TypeUsage toType = GetCastTargetType(cqt.ResultType, toClrType, fromClrType, false); if (null != toType) { return cqt.CastTo(toType); } else { return cqt; } }
0
5. Example
View licenseprotected override CqtExpression WrapNonCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType) { // always count a constant value DbExpression constantExpression = DbExpressionBuilder.Constant(1); if (!TypeUsageEquals(constantExpression.ResultType, returnType)) { constantExpression = constantExpression.CastTo(returnType); } return constantExpression; }
0
6. Example
View licensepublic override DbExpression Visit(CastOp op, Node n) { // Direct conversion to DbCastExpression with the same Type and converted argument DbExpression return VisitChild(n, 0).CastTo(op.Type); }
0
7. Example
View licenseprivate DbExpression CreateCastExpression(DbExpression source, Type toClrType, Type fromClrType) { // see if the source can be normalized as a set DbExpression setSource = NormalizeSetSource(source); if (!Object.ReferenceEquals(source, setSource)) { // if the resulting cast is a no-op (no either kind is supported // for set sources), yield the source if (null == GetCastTargetType(setSource.ResultType, toClrType, fromClrType, true)) { return source; } } // try to find the appropriate target target for the cast TypeUsage toType = GetCastTargetType(source.ResultType, toClrType, fromClrType, true); if (null == toType) { // null indicates a no-op cast (from the perspective of the model) return source; } return source.CastTo(toType); }
0
8. Example
View licenseprotected virtual CqtExpression WrapCollectionOperand(ExpressionConverter parent, CqtExpression operand, TypeUsage returnType) { // check if the operand needs to be wrapped to ensure the correct function overload is called if (!TypeUsageEquals(returnType, ((CollectionType)operand.ResultType.EdmType).TypeUsage)) { DbExpressionBinding operandCastBinding = operand.BindAs(parent.AliasGenerator.Next()); DbProjectExpression operandCastProjection = operandCastBinding.Project(operandCastBinding.Variable.CastTo(returnType)); operand = operandCastProjection; } return operand; }
0
9. Example
View licenseprivate static DbExpression CreateConstructorCallExpression(AST.MethodExpr methodExpr, /n ..... /n //View Source file for more details /n }
0
10. Example
View licenseprivate DbExpression GenerateScalarResultMappingView(DbExpression storeFunctionInvoke) { /n ..... /n //View Source file for more details /n }
0
11. Example
View licenseprivate static Dictionary<AST.BuiltInKind, BuiltInExprConverter> CreateBuiltInExprConverter() /n ..... /n //View Source file for more details /n }