System.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.RequireCompatibleType(System.Data.Common.CommandTrees.DbExpression, System.Data.Metadata.Edm.RelationshipEndMember, bool)

Here are the examples of the csharp api class System.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.RequireCompatibleType(System.Data.Common.CommandTrees.DbExpression, System.Data.Metadata.Edm.RelationshipEndMember, bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

10 Examples 7

1. Example

View license
private static void RequireCompatibleType(DbExpression expression, TypeUsage requiredResultType, string argumentName)
        {
            RequireCompatibleType(expression, requiredResultType, argumentName, -1);
        }

2. Example

View license
private static void RequireCompatibleType(DbExpression expression, PrimitiveTypeKind requiredResultType, string argumentName)
        {
            RequireCompatibleType(expression, requiredResultType, argumentName, -1);
        }

3. Example

View license
internal static TypeUsage ValidateInvoke(DbLambda lambda, IEnumerable<DbExpression> arguments, out DbExpressionList validArguments)
        {
            EntityUtil.CheckArgumentNull(lambda, "lambda");
            EntityUtil.CheckArgumentNull(arguments, "arguments");

            // Each argument must be type-compatible with the corresponding lambda variable for which it supplies the value
            validArguments = null;
            var argValidator = CreateValidator(arguments, "arguments", (exp, idx) =>
                {
                    RequireCompatibleType(exp, lambda.Variables[idx].ResultType, "arguments", idx);
                    return exp;
                },
                expList => new DbExpressionList(expList)
            );
            argValidator.ExpectedElementCount = lambda.Variables.Count;
            validArguments = argValidator.Validate();

            // The result type of the lambda expression is the result type of the lambda body
            return lambda.Body.ResultType;
        }

4. Example

View license
internal static TypeUsage ValidateCase(IEnumerable<DbExpression> whenExpressions, IEnumerable&/n ..... /n //View Source file for more details /n }

5. Example

View license
internal static DbExpressionList ValidateFunctionAggregate(EdmFunction function, IEnumerable<DbExpression> args)
        {
            //
            // Verify that the aggregate function is from the metadata collection and data space of the command tree.
            //
            ArgumentValidation.CheckFunction(function);

            // Verify that the function is actually a valid aggregate function.
            // For now, only a single argument is allowed.
            if (!TypeSemantics.IsAggregateFunction(function) || null == function.ReturnParameter)
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.Cqt_Aggregate_InvalidFunction, "function");
            }

            FunctionParameter[] expectedParams = GetExpectedParameters(function);
            DbExpressionList funcArgs = CreateExpressionList(args, "argument", expectedParams.Length, (exp, idx) =>
                {
                    TypeUsage paramType = expectedParams[idx].TypeUsage;
                    TypeUsage elementType = null;
                    if (TypeHelpers.TryGetCollectionElementType(paramType, out elementType))
                    {
                        paramType = elementType;
                    }

                    ArgumentValidation.RequireCompatibleType(exp, paramType, "argument");
                }
            );

            return funcArgs;
        }

6. Example

View license
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPriva/n ..... /n //View Source file for more details /n }

7. Example

View license
internal static TypeUsage ValidateFunction(EdmFunction function, IEnumerable<DbExpression> arg/n ..... /n //View Source file for more details /n }

8. Example

View license
internal static TypeUsage ValidateNew(TypeUsage instanceType, IEnumerable<DbExpression> arguments, out DbExpressionList validArguments)
        {
            //
            // Ensure that the type is non-null, valid and not NullType
            //
            CheckType(instanceType, "instanceType");

            CollectionType collectionType = null;
            if (TypeHelpers.TryGetEdmType<CollectionType>(instanceType, out collectionType) &&
                collectionType != null)
            {
                // Collection arguments may have zero count for empty collection construction
                TypeUsage elementType = collectionType.TypeUsage;
                validArguments = CreateExpressionList(arguments, "arguments", true, (exp, idx) =>
                    {
                        RequireCompatibleType(exp, elementType, "arguments", idx);
                    });
            }
            else
            {
                List<TypeUsage> expectedTypes = GetStructuralMemberTypes(instanceType);
                int pos = 0;
                validArguments = CreateExpressionList(arguments, "arguments", expectedTypes.Count, (exp, idx) =>
                    {
                        RequireCompatibleType(exp, expectedTypes[pos++], "arguments", idx);
                    });
            }

            return instanceType;
        }

9. Example

View license
internal static TypeUsage ValidateNavigate(DbExpression navigateFrom, RelationshipEndMember fromEnd, RelationshipEndMember toEnd, out RelationshipType relType, bool allowAllRelationshipsInSameTypeHierarchy)
        {
            EntityUtil.CheckArgumentNull(navigateFrom, "navigateFrom");

            //
            // Validate the relationship ends before use
            //
            CheckMember(fromEnd, "fromEnd");
            CheckMember(toEnd, "toEnd");

            relType = fromEnd.DeclaringType as RelationshipType;

            //
            // Ensure that the relation type is non-null and read-only
            //
            CheckType(relType);

            //
            // Validate that the 'to' relationship end is defined by the same relationship type as the 'from' end
            //
            if (!relType.Equals(toEnd.DeclaringType))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.Cqt_Factory_IncompatibleRelationEnds, "toEnd");
            }

            RequireCompatibleType(navigateFrom, fromEnd, allowAllRelationshipsInSameTypeHierarchy);

            return CreateResultType(toEnd);
        }

10. Example

View license
internal static TypeUsage ValidateCreateRef(EntitySet entitySet, EntityType entityType, IEnumerable&/n ..... /n //View Source file for more details /n }