System.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.CheckDataSpace(System.Data.Metadata.Edm.TypeUsage)

Here are the examples of the csharp api class System.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.CheckDataSpace(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

View license
private static bool CheckDataSpace(GlobalItem item)
        {
            // Since the set of primitive types and canonical functions are shared, we don't need to check for them.
            // Additionally, any non-canonical function in the C-Space must be a cached store function, which will
            // also not be present in the workspace.
            if (BuiltInTypeKind.PrimitiveType == item.BuiltInTypeKind ||
                (BuiltInTypeKind.EdmFunction == item.BuiltInTypeKind && DataSpace.CSpace == item.DataSpace))
            {
                return true;
            }

            // Transient types should be checked according to their non-transient element types
            if (Helper.IsRowType(item))
            {
                foreach (EdmProperty prop in ((RowType)item).Properties)
                {
                    if (!CheckDataSpace(prop.TypeUsage))
                    {
                        return false;
                    }
                }

                return true;
            }
            else if (Helper.IsCollectionType(item))
            {
                return CheckDataSpace(((CollectionType)item).TypeUsage);
            }
            else if (Helper.IsRefType(item))
            {
                return CheckDataSpace(((RefType)item).ElementType);
            }
            else
            {
                return (item.DataSpace == DataSpace.SSpace || item.DataSpace == DataSpace.CSpace);
            }
        }

2. Example

View license
private static void CheckType(TypeUsage type, string varName)
        {
            EntityUtil.CheckArgumentNull(type, varName);
            CheckReadOnly(type, varName);

            // TypeUsage constructor is responsible for basic validation of EdmType
            Debug.Assert(type.EdmType != null, "TypeUsage constructor allowed null EdmType?");
            
            if (!CheckDataSpace(type))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.Cqt_Metadata_TypeUsageIncorrectSpace, "type");
            }
        }

3. Example

View license
private static void CheckParameter(FunctionParameter paramMeta, string varName)
        {
            EntityUtil.CheckArgumentNull(paramMeta, varName);
            CheckReadOnly(paramMeta.DeclaringFunction, varName);

            // FunctionParameter constructor is responsible for basic validation
            Debug.Assert(paramMeta.Name != null, "FunctionParameter constructor allowed null name?");
            
            // Verify that the parameter is from the same workspace as the DbCommandTree
            if (!CheckDataSpace(paramMeta.TypeUsage))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.Cqt_Metadata_FunctionParameterIncorrectSpace, varName);
            }
        }

4. Example

View license
private static void CheckMember(EdmMember memberMeta, string varName)
        {
            EntityUtil.CheckArgumentNull(memberMeta, varName);
            CheckReadOnly(memberMeta.DeclaringType, varName);

            // EdmMember constructor is responsible for basic validation
            Debug.Assert(memberMeta.Name != null, "EdmMember constructor allowed null name?");
            Debug.Assert(null != memberMeta.TypeUsage, "EdmMember constructor allowed null for TypeUsage?");
            Debug.Assert(null != memberMeta.DeclaringType, "EdmMember constructor allowed null for DeclaringType?");
            if(!CheckDataSpace(memberMeta.TypeUsage) || !CheckDataSpace(memberMeta.DeclaringType))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.Cqt_Metadata_EdmMemberIncorrectSpace, varName);
            }
        }

5. Example

View license
private static void CheckFunction(EdmFunction function)
        {
            EntityUtil.CheckArgume/n ..... /n //View Source file for more details /n }