Ejemplo n.º 1
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);
		}
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 5
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());
			}
		}
Ejemplo n.º 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");
     }
 }
Ejemplo n.º 7
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");
			}
		}
Ejemplo n.º 8
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);
		}