示例#1
0
        public static TableResourceContainer GetUtilityRowResourceContainer(string accountName, string tableName)
        {
            System.Data.Services.Providers.ResourceType resourceType = new System.Data.Services.Providers.ResourceType(typeof(UtilityRow), ResourceTypeKind.EntityType, null, accountName, tableName, false)
            {
                CanReflectOnInstanceType = false,
                IsOpenType = true
            };
            ResourceProperty utilityRowResourceProperty = new UtilityRowResourceProperty("PartitionKey", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, System.Data.Services.Providers.ResourceType.GetPrimitiveResourceType(typeof(string)))
            {
                CanReflectOnInstanceTypeProperty = false
            };

            resourceType.AddProperty(utilityRowResourceProperty);
            ResourceProperty resourceProperty = new UtilityRowResourceProperty("RowKey", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, System.Data.Services.Providers.ResourceType.GetPrimitiveResourceType(typeof(string)))
            {
                CanReflectOnInstanceTypeProperty = false
            };

            resourceType.AddProperty(resourceProperty);
            ResourceProperty utilityRowResourceProperty1 = new UtilityRowResourceProperty("Timestamp", ResourcePropertyKind.Primitive | ResourcePropertyKind.ETag, System.Data.Services.Providers.ResourceType.GetPrimitiveResourceType(typeof(DateTime)))
            {
                CanReflectOnInstanceTypeProperty = false
            };

            resourceType.AddProperty(utilityRowResourceProperty1);
            TableResourceContainer tableResourceContainer = new TableResourceContainer(tableName, resourceType);

            tableResourceContainer.SetReadOnly();
            return(tableResourceContainer);
        }
示例#2
0
        public static TableResourceContainer GetUtilityTableResourceContainer(string accountName, bool PremiumTableAccountRequest)
        {
            System.Data.Services.Providers.ResourceType resourceType = new System.Data.Services.Providers.ResourceType(typeof(UtilityTable), ResourceTypeKind.EntityType, null, accountName, "Tables", false)
            {
                CanReflectOnInstanceType = false,
                IsOpenType = true
            };
            if (PremiumTableAccountRequest)
            {
                resourceType.AddProperty(TableResourceContainer.ProvisionedIOPSProperty);
                resourceType.AddProperty(TableResourceContainer.TableStatusProperty);
                resourceType.AddProperty(TableResourceContainer.RequestedIOPSProperty);
            }
            ResourceProperty utilityTableResourceProperty = new UtilityTableResourceProperty("TableName", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, System.Data.Services.Providers.ResourceType.GetPrimitiveResourceType(typeof(string)))
            {
                CanReflectOnInstanceTypeProperty = false
            };

            resourceType.AddProperty(utilityTableResourceProperty);
            TableResourceContainer tableResourceContainer = new TableResourceContainer("Tables", resourceType);

            tableResourceContainer.SetReadOnly();
            return(tableResourceContainer);
        }