예제 #1
0
파일: Schema.cs 프로젝트: nickchal/pash
		internal void AddComplexCollectionProperty(ResourceType resourceType, string name, ResourceType complexType)
		{
			CollectionResourceType collectionResourceType = ResourceType.GetCollectionResourceType(complexType);
			ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.Collection, collectionResourceType);
			resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
			PropertyCustomState propertyCustomState = new PropertyCustomState();
			resourcePropertyWithDescription.CustomState = propertyCustomState;
			resourceType.AddProperty(resourcePropertyWithDescription);
		}
예제 #2
0
        internal void AddComplexCollectionProperty(ResourceType resourceType, string name, ResourceType complexType)
        {
            CollectionResourceType collectionResourceType          = ResourceType.GetCollectionResourceType(complexType);
            ResourceProperty       resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.Collection, collectionResourceType);

            resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
            PropertyCustomState propertyCustomState = new PropertyCustomState();

            resourcePropertyWithDescription.CustomState = propertyCustomState;
            resourceType.AddProperty(resourcePropertyWithDescription);
        }
예제 #3
0
        internal void AddPrimitiveCollectionProperty(ResourceType resourceType, string name, Type propertyType, object defaultValue)
        {
            CollectionResourceType collectionResourceType          = ResourceType.GetCollectionResourceType(ResourceType.GetPrimitiveResourceType(propertyType));
            ResourceProperty       resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.Collection, collectionResourceType);

            resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
            PropertyCustomState propertyCustomState = new PropertyCustomState();

            propertyCustomState.DefaultValue            = defaultValue;
            resourcePropertyWithDescription.CustomState = propertyCustomState;
            resourceType.AddProperty(resourcePropertyWithDescription);
        }
예제 #4
0
 internal void AddComplexProperty(ResourceType resourceType, string name, ResourceType complexType)
 {
     if (complexType.ResourceTypeKind == ResourceTypeKind.ComplexType)
     {
         ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.ComplexType, complexType);
         resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
         PropertyCustomState propertyCustomState = new PropertyCustomState();
         resourcePropertyWithDescription.CustomState = propertyCustomState;
         resourceType.AddProperty(resourcePropertyWithDescription);
         return;
     }
     else
     {
         throw new InvalidResourceTypeException(complexType.Name, complexType.ResourceTypeKind.ToString(), ResourceTypeKind.ComplexType.ToString());
     }
 }
예제 #5
0
파일: Schema.cs 프로젝트: nickchal/pash
		internal void AddComplexProperty(ResourceType resourceType, string name, ResourceType complexType)
		{
			if (complexType.ResourceTypeKind == ResourceTypeKind.ComplexType)
			{
				ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.ComplexType, complexType);
				resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
				PropertyCustomState propertyCustomState = new PropertyCustomState();
				resourcePropertyWithDescription.CustomState = propertyCustomState;
				resourceType.AddProperty(resourcePropertyWithDescription);
				return;
			}
			else
			{
				throw new InvalidResourceTypeException(complexType.Name, complexType.ResourceTypeKind.ToString(), ResourceTypeKind.ComplexType.ToString());
			}
		}
예제 #6
0
 internal void AddPrimitiveProperty(ResourceType resourceType, string name, Type propertyType, ResourcePropertyKind flags, object defaultValue)
 {
     if (flags == ResourcePropertyKind.Primitive || flags == (ResourcePropertyKind.Primitive | ResourcePropertyKind.ETag) || flags == (ResourcePropertyKind.Primitive | ResourcePropertyKind.Key))
     {
         ResourceType         primitiveResourceType = ResourceType.GetPrimitiveResourceType(propertyType);
         ResourcePropertyKind resourcePropertyKind  = ResourcePropertyKind.Primitive;
         resourcePropertyKind = resourcePropertyKind | flags;
         ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, resourcePropertyKind, primitiveResourceType);
         resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
         PropertyCustomState propertyCustomState = new PropertyCustomState();
         propertyCustomState.DefaultValue            = defaultValue;
         resourcePropertyWithDescription.CustomState = propertyCustomState;
         resourceType.AddProperty(resourcePropertyWithDescription);
         return;
     }
     else
     {
         throw new ArgumentException(ExceptionHelpers.GetExceptionMessage(Resources.SchemaInvalidKeyOrEtagDiscrepancy, new object[0]), "flags");
     }
 }
예제 #7
0
파일: Schema.cs 프로젝트: nickchal/pash
		internal void AddPrimitiveProperty(ResourceType resourceType, string name, Type propertyType, ResourcePropertyKind flags, object defaultValue)
		{
			if (flags == ResourcePropertyKind.Primitive || flags == (ResourcePropertyKind.Primitive | ResourcePropertyKind.ETag) || flags == (ResourcePropertyKind.Primitive | ResourcePropertyKind.Key))
			{
				ResourceType primitiveResourceType = ResourceType.GetPrimitiveResourceType(propertyType);
				ResourcePropertyKind resourcePropertyKind = ResourcePropertyKind.Primitive;
				resourcePropertyKind = resourcePropertyKind | flags;
				ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, resourcePropertyKind, primitiveResourceType);
				resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
				PropertyCustomState propertyCustomState = new PropertyCustomState();
				propertyCustomState.DefaultValue = defaultValue;
				resourcePropertyWithDescription.CustomState = propertyCustomState;
				resourceType.AddProperty(resourcePropertyWithDescription);
				return;
			}
			else
			{
				throw new ArgumentException(ExceptionHelpers.GetExceptionMessage(Resources.SchemaInvalidKeyOrEtagDiscrepancy, new object[0]), "flags");
			}
		}
예제 #8
0
파일: Schema.cs 프로젝트: nickchal/pash
		internal void AddPrimitiveCollectionProperty(ResourceType resourceType, string name, Type propertyType, object defaultValue)
		{
			CollectionResourceType collectionResourceType = ResourceType.GetCollectionResourceType(ResourceType.GetPrimitiveResourceType(propertyType));
			ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.Collection, collectionResourceType);
			resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
			PropertyCustomState propertyCustomState = new PropertyCustomState();
			propertyCustomState.DefaultValue = defaultValue;
			resourcePropertyWithDescription.CustomState = propertyCustomState;
			resourceType.AddProperty(resourcePropertyWithDescription);
		}