Esempio n. 1
0
 public ResourceType(Type instanceType, System.Data.Services.Providers.ResourceTypeKind resourceTypeKind, ResourceType baseType, string namespaceName, string name, bool isAbstract) : this(instanceType, baseType, namespaceName, name, isAbstract)
 {
     WebUtil.CheckArgumentNull <Type>(instanceType, "instanceType");
     WebUtil.CheckStringArgumentNullOrEmpty(name, "name");
     WebUtil.CheckResourceTypeKind(resourceTypeKind, "resourceTypeKind");
     if (((resourceTypeKind == System.Data.Services.Providers.ResourceTypeKind.Primitive) || (resourceTypeKind == System.Data.Services.Providers.ResourceTypeKind.Collection)) || (resourceTypeKind == System.Data.Services.Providers.ResourceTypeKind.EntityCollection))
     {
         throw new ArgumentException(System.Data.Services.Strings.ResourceType_InvalidValueForResourceTypeKind("resourceTypeKind"), "resourceTypeKind");
     }
     if ((baseType != null) && (baseType.ResourceTypeKind != resourceTypeKind))
     {
         throw new ArgumentException(System.Data.Services.Strings.ResourceType_InvalidResourceTypeKindInheritance(resourceTypeKind.ToString(), baseType.ResourceTypeKind.ToString()), "resourceTypeKind");
     }
     if (instanceType.IsValueType)
     {
         throw new ArgumentException(System.Data.Services.Strings.ResourceType_TypeCannotBeValueType, "instanceType");
     }
     this.resourceTypeKind = resourceTypeKind;
 }
Esempio n. 2
0
        internal ResourceType(Type type, System.Data.Services.Providers.ResourceTypeKind resourceTypeKind, string namespaceName, string name) : this(type, null, namespaceName, name, false)
        {
            this.resourceTypeKind = resourceTypeKind;
            this.isReadOnly = true;
            switch (resourceTypeKind)
            {
                case System.Data.Services.Providers.ResourceTypeKind.Primitive:
                    this.InitializeMetadataAndSchemaVersionForPrimitiveType();
                    return;

                case System.Data.Services.Providers.ResourceTypeKind.Collection:
                    this.InitializeMetadataAndSchemaVersionForCollectionType();
                    return;

                case System.Data.Services.Providers.ResourceTypeKind.EntityCollection:
                    this.InitializeMetadataAndSchemaVersionForEntityCollectionType();
                    return;
            }
        }
Esempio n. 3
0
        internal ResourceType(Type type, System.Data.Services.Providers.ResourceTypeKind resourceTypeKind, string namespaceName, string name) : this(type, null, namespaceName, name, false)
        {
            this.resourceTypeKind = resourceTypeKind;
            this.isReadOnly       = true;
            switch (resourceTypeKind)
            {
            case System.Data.Services.Providers.ResourceTypeKind.Primitive:
                this.InitializeMetadataAndSchemaVersionForPrimitiveType();
                return;

            case System.Data.Services.Providers.ResourceTypeKind.Collection:
                this.InitializeMetadataAndSchemaVersionForCollectionType();
                return;

            case System.Data.Services.Providers.ResourceTypeKind.EntityCollection:
                this.InitializeMetadataAndSchemaVersionForEntityCollectionType();
                return;
            }
        }
Esempio n. 4
0
 public ResourceType(Type instanceType, System.Data.Services.Providers.ResourceTypeKind resourceTypeKind, ResourceType baseType, string namespaceName, string name, bool isAbstract) : this(instanceType, baseType, namespaceName, name, isAbstract)
 {
     WebUtil.CheckArgumentNull<Type>(instanceType, "instanceType");
     WebUtil.CheckStringArgumentNullOrEmpty(name, "name");
     WebUtil.CheckResourceTypeKind(resourceTypeKind, "resourceTypeKind");
     if (((resourceTypeKind == System.Data.Services.Providers.ResourceTypeKind.Primitive) || (resourceTypeKind == System.Data.Services.Providers.ResourceTypeKind.Collection)) || (resourceTypeKind == System.Data.Services.Providers.ResourceTypeKind.EntityCollection))
     {
         throw new ArgumentException(System.Data.Services.Strings.ResourceType_InvalidValueForResourceTypeKind("resourceTypeKind"), "resourceTypeKind");
     }
     if ((baseType != null) && (baseType.ResourceTypeKind != resourceTypeKind))
     {
         throw new ArgumentException(System.Data.Services.Strings.ResourceType_InvalidResourceTypeKindInheritance(resourceTypeKind.ToString(), baseType.ResourceTypeKind.ToString()), "resourceTypeKind");
     }
     if (instanceType.IsValueType)
     {
         throw new ArgumentException(System.Data.Services.Strings.ResourceType_TypeCannotBeValueType, "instanceType");
     }
     this.resourceTypeKind = resourceTypeKind;
 }