System.Data.Common.CommandTrees.Internal.DbExpressionValidator.ThrowInvalid(string)

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

4 Examples 7

1. Example

Project: referencesource
Source File: Validator.cs
View license
private void ThrowInvalidMetadata<TMetadata>(TMetadata invalid)
        {
            ThrowInvalid(Strings.Cqt_Validator_InvalidOtherWorkspaceMetadata(typeof(TMetadata).Name));
        }

2. Example

Project: referencesource
Source File: Validator.cs
View license
private void ThrowInvalidSpace<TMetadata>(TMetadata invalid)
        {
            ThrowInvalid(Strings.Cqt_Validator_InvalidIncorrectDataSpaceMetadata(typeof(TMetadata).Name, Enum.GetName(typeof(DataSpace), this.requiredSpace)));
        }

3. Example

Project: referencesource
Source File: Validator.cs
View license
public override DbExpression Visit(DbVariableReferenceExpression expression)
        {
            DbExpression result = base.Visit(expression);
            if(result.ExpressionKind == DbExpressionKind.VariableReference)
            {
                DbVariableReferenceExpression varRef = (DbVariableReferenceExpression)result;
                TypeUsage foundType = null;
                foreach(Dictionary<string, TypeUsage> scope in this.variableScopes)
                {
                    if(scope.TryGetValue(varRef.VariableName, out foundType))
                    {
                        break;
                    }
                }
                
                if(foundType == null)
                {
                    ThrowInvalid(System.Data.Entity.Strings.Cqt_Validator_VarRefInvalid(varRef.VariableName));
                }
                                
                // SQLBUDT#545720: Equivalence is not a sufficient check (consider row types) - equality is required.
                if (!TypeSemantics.IsEqual(varRef.ResultType, foundType))
                {
                    ThrowInvalid(System.Data.Entity.Strings.Cqt_Validator_VarRefTypeMismatch(varRef.VariableName));
                }
            }

            return result;
        }

4. Example

Project: referencesource
Source File: Validator.cs
View license
public override DbExpression Visit(DbParameterReferenceExpression expression)
        {
            DbExpression result = base.Visit(expression);
            if (result.ExpressionKind == DbExpressionKind.ParameterReference)
            {
                DbParameterReferenceExpression paramRef = result as DbParameterReferenceExpression;

                DbParameterReferenceExpression foundParam;
                if (this.paramMappings.TryGetValue(paramRef.ParameterName, out foundParam))
                {
                    // SQLBUDT#545720: Equivalence is not a sufficient check (consider row types for TVPs) - equality is required.
                    if (!TypeSemantics.IsEqual(paramRef.ResultType, foundParam.ResultType))
                    {
                        ThrowInvalid(Strings.Cqt_Validator_InvalidIncompatibleParameterReferences(paramRef.ParameterName));
                    }
                }
                else
                {
                    this.paramMappings.Add(paramRef.ParameterName, paramRef);
                }
            }
            return result;
        }