Esempio n. 1
0
        internal void AddResourceSetReferenceProperty(ResourceType sourceType, string name, ResourceType targetType, Schema.AssociationType assocType)
        {
            ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.ResourceSetReference, targetType);

            resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
            resourcePropertyWithDescription.CustomState = new ReferenceCustomState(true);
            resourcePropertyWithDescription.GetReferenceCustomState().AssociationType = assocType;
            sourceType.AddProperty(resourcePropertyWithDescription);
        }
Esempio 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);
		}
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio 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());
     }
 }
Esempio n. 6
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());
			}
		}
Esempio 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");
     }
 }
Esempio n. 8
0
		internal void AddResourceSetReferenceProperty(ResourceType sourceType, string name, ResourceType targetType, Schema.AssociationType assocType)
		{
			ResourceProperty resourcePropertyWithDescription = new ResourcePropertyWithDescription(name, ResourcePropertyKind.ResourceSetReference, targetType);
			resourcePropertyWithDescription.CanReflectOnInstanceTypeProperty = false;
			resourcePropertyWithDescription.CustomState = new ReferenceCustomState(true);
			resourcePropertyWithDescription.GetReferenceCustomState().AssociationType = assocType;
			sourceType.AddProperty(resourcePropertyWithDescription);
		}
Esempio n. 9
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");
			}
		}
Esempio n. 10
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);
		}