コード例 #1
0
ファイル: DSPMetadata.cs プロジェクト: zhonli/odata.net
        /// <summary>Adds a new entity or complex type (without any properties).</summary>
        /// <param name="name">The name of the type.</param>
        /// <param name="instanceType">The instance type or null if this should be untyped resource.</param>
        /// <param name="baseType">The base type.</param>
        /// <param name="isAbstract">If the type should be abstract.</param>
        /// <param name="entityType">If the new type should be an entity type, or complex type otherwise.</param>
        /// <returns>The newly created resource type.</returns>
        private ResourceType AddResourceType(string name, Type instanceType, ResourceType baseType, bool isAbstract, bool entityType)
        {
            instanceType = instanceType ?? typeof(DSPResource);
            DSPResourceType resourceType = new DSPResourceType(instanceType, entityType ? ResourceTypeKind.EntityType : ResourceTypeKind.ComplexType, baseType, this.namespaceName, name, isAbstract);

            resourceType.CanReflectOnInstanceType = instanceType != typeof(DSPResource);
            resourceType.CustomState = new ResourceTypeAnnotation();
            this.resourceTypes.Add(resourceType.FullName, resourceType);
            return(resourceType);
        }
コード例 #2
0
ファイル: DSPMetadata.cs プロジェクト: larsenjo/odata.net
 /// <summary>Adds a new entity or complex type (without any properties).</summary>
 /// <param name="name">The name of the type.</param>
 /// <param name="instanceType">The instance type or null if this should be untyped resource.</param>
 /// <param name="baseType">The base type.</param>
 /// <param name="isAbstract">If the type should be abstract.</param>
 /// <param name="entityType">If the new type should be an entity type, or complex type otherwise.</param>
 /// <returns>The newly created resource type.</returns>
 private ResourceType AddResourceType(string name, Type instanceType, ResourceType baseType, bool isAbstract, bool entityType)
 {
     instanceType = instanceType ?? typeof(DSPResource);
     DSPResourceType resourceType = new DSPResourceType(instanceType, entityType ? ResourceTypeKind.EntityType : ResourceTypeKind.ComplexType, baseType, this.namespaceName, name, isAbstract);
     resourceType.CanReflectOnInstanceType = instanceType != typeof(DSPResource);
     resourceType.CustomState = new ResourceTypeAnnotation();
     this.resourceTypes.Add(resourceType.FullName, resourceType);
     return resourceType;
 }