• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Providers.ResourceType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.OData.Service.Providers.ResourceType的典型用法代码示例。如果您正苦于以下问题:C# ResourceType类的具体用法?C# ResourceType怎么用?C# ResourceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResourceType类属于Microsoft.OData.Service.Providers命名空间,在下文中一共展示了ResourceType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OperationLinkBuilderTests

        public OperationLinkBuilderTests()
        {
            ResourceType intType = ResourceType.GetPrimitiveResourceType(typeof(int));

            var customerType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "FQ.NS", "Customer", false);
            customerType.CanReflectOnInstanceType = false;
            customerType.AddProperty(new ResourceProperty("Id", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, intType) { CanReflectOnInstanceTypeProperty = false });
            customerType.SetReadOnly();

            var operation = new ServiceAction("Action", intType, OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("P1", customerType), new ServiceActionParameter("P2", intType) }, null);
            operation.SetReadOnly();
            this.operationWithParameters = new OperationWrapper(operation);

            var typeWithEscapedName = new ResourceType(typeof(object), ResourceTypeKind.ComplexType, null, "FQ NS", "+ /", false);
            typeWithEscapedName.CanReflectOnInstanceType = false;
            typeWithEscapedName.AddProperty(new ResourceProperty("Number", ResourcePropertyKind.Primitive, intType) { CanReflectOnInstanceTypeProperty = false });
            typeWithEscapedName.SetReadOnly();

            operation = new ServiceAction("Action", intType, OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("P1", customerType), new ServiceActionParameter("P2", typeWithEscapedName) }, null);
            operation.SetReadOnly();
            this.operationWithEscapedParameter = new OperationWrapper(operation);

            var bestCustomerType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, customerType, "FQ.NS", "BestCustomer", false);
            bestCustomerType.SetReadOnly();

            operation = new ServiceAction("Action", intType, OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("P1", customerType) }, null);
            operation.SetReadOnly();
            this.operationBoundToBaseType = new OperationWrapper(operation);

            this.entityToSerialize = EntityToSerialize.CreateFromExplicitValues(new object(), bestCustomerType, new TestSerializedEntityKey("http://odata.org/Service.svc/Customers/", bestCustomerType.FullName));

            var metadataUri = new Uri("http://odata.org/Service.svc/$metadata");
            this.testSubject = new OperationLinkBuilder("MyContainer", metadataUri);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:34,代码来源:OperationLinkBuilderTests.cs


示例2: Init

        public void Init()
        {
            this.baseType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "Fake.NS", "BaseType", false) {CanReflectOnInstanceType = false};
            this.baseType.AddProperty(new ResourceProperty("Id", ResourcePropertyKind.Key | ResourcePropertyKind.Primitive, ResourceType.GetPrimitiveResourceType(typeof(int))) { CanReflectOnInstanceTypeProperty = false });
            this.baseType.SetReadOnly();
            
            this.entityType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, this.baseType, "Fake.NS", "Type", false) {CanReflectOnInstanceType = false};
            this.entityType.SetReadOnly();

            this.derivedType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, this.entityType, "Fake.NS", "DerivedType", false) { CanReflectOnInstanceType = false };
            this.derivedType.SetReadOnly();

            var resourceSet = new ResourceSet("Set", this.entityType);
            resourceSet.SetReadOnly();
            this.resourceSetWrapper = ResourceSetWrapper.CreateForTests(resourceSet);

            this.action = new ServiceAction("Fake", ResourceType.GetPrimitiveResourceType(typeof(int)), OperationParameterBindingKind.Sometimes, new[] {new ServiceActionParameter("p1", this.entityType)}, null);
            this.action.SetReadOnly();
            this.actionWrapper = new OperationWrapper(action);

            this.derivedAction = new ServiceAction("Fake", ResourceType.GetPrimitiveResourceType(typeof(int)), OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("p1", this.derivedType) }, null);
            this.derivedAction.SetReadOnly();
            this.derivedActionWrapper = new OperationWrapper(derivedAction);

            this.testSubject = new SelectedOperationsCache();
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:26,代码来源:SelectedOperationsCacheTests.cs


示例3: RootProjectionNode

        /// <summary>Creates new root node for the projection tree.</summary>
        /// <param name="resourceSetWrapper">The resource set of the root level of the query.</param>
        /// <param name="orderingInfo">The ordering info for this node. null means no ordering to be applied.</param>
        /// <param name="filter">The filter for this node. null means no filter to be applied.</param>
        /// <param name="skipCount">Number of results to skip. null means no results to be skipped.</param>
        /// <param name="takeCount">Maximum number of results to return. null means return all available results.</param>
        /// <param name="maxResultsExpected">Maximum number of expected results. Hint that the provider should return
        /// at least maxResultsExpected + 1 results (if available).</param>
        /// <param name="expandPaths">The list of expanded paths.</param>
        /// <param name="baseResourceType">The resource type for all entities in this query.</param>
        /// <param name="selectExpandClause">The select expand clause for the current node from the URI Parser.</param>
        internal RootProjectionNode(
            ResourceSetWrapper resourceSetWrapper,
            OrderingInfo orderingInfo,
            Expression filter,
            int? skipCount,
            int? takeCount,
            int? maxResultsExpected,
            List<ExpandSegmentCollection> expandPaths,
            ResourceType baseResourceType,
            SelectExpandClause selectExpandClause)
            : base(
                String.Empty,
                null,
                null,
                resourceSetWrapper,
                orderingInfo,
                filter,
                skipCount,
                takeCount,
                maxResultsExpected,
                selectExpandClause)
        {
            Debug.Assert(baseResourceType != null, "baseResourceType != null");

            this.expandPaths = expandPaths;
            this.baseResourceType = baseResourceType;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:38,代码来源:RootProjectionNode.cs


示例4: OperationSerializerTests

        public OperationSerializerTests()
        {
            ResourceType intType = ResourceType.GetPrimitiveResourceType(typeof(int));

            var customerType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "FQ.NS", "Customer", false);
            customerType.CanReflectOnInstanceType = false;
            customerType.AddProperty(new ResourceProperty("Id", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, intType) { CanReflectOnInstanceTypeProperty = false });
            customerType.SetReadOnly();

            var operation = new ServiceAction("Action", intType, OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("P1", customerType), new ServiceActionParameter("P2", intType) }, null);
            operation.SetReadOnly();
            this.baseTypeOperation = new OperationWrapper(operation);

            var bestCustomerType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, customerType, "FQ.NS", "BestCustomer", false);
            bestCustomerType.SetReadOnly();

            operation = new ServiceAction("Action", intType, OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("P1", bestCustomerType) }, null);
            operation.SetReadOnly();
            this.derivedTypeOperation = new OperationWrapper(operation);

            operation = new ServiceAction("Unambiguous", intType, OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("P1", customerType) }, null);
            operation.SetReadOnly();
            this.unambiguousOperation = new OperationWrapper(operation);

            this.entityToSerialize = EntityToSerialize.CreateFromExplicitValues(new object(), bestCustomerType, new TestSerializedEntityKey("http://odata.org/Service.svc/Customers(0)/", bestCustomerType.FullName));

            this.testSubject = CreateOperationSerializer(AlwaysAdvertiseActions);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:28,代码来源:OperationSerializerTests.cs


示例5: GetTestInstance

        /// <summary>
        /// Returns a test instance of one of the provider OM types.
        /// </summary>
        /// <param name="type">The type to get instance of.</param>
        /// <returns>The </returns>
        public static object GetTestInstance(Type type)
        {
            if (type == typeof(ResourceType))
            {
                ResourceProperty p = new ResourceProperty("ID", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, ResourceType.GetPrimitiveResourceType(typeof(int))) { CanReflectOnInstanceTypeProperty = false };
                ResourceType resourceType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "Foo", "NoBaseType", false);
                Assert.IsTrue(resourceType.KeyProperties.Count == 0, "It's okay not to have key properties, since we haven't set this type to readonly yet");
                resourceType.AddProperty(p);
                return resourceType;
            }
            else if (type == typeof(ResourceProperty))
            {
                return new ResourceProperty("NonKeyProperty", ResourcePropertyKind.Primitive, ResourceType.GetPrimitiveResourceType(typeof(int)));
            }
            else if (type == typeof(ServiceOperation))
            {
                ServiceOperationParameter parameter = new ServiceOperationParameter("o", ResourceType.GetPrimitiveResourceType(typeof(string)));
                ServiceOperation operation = new ServiceOperation("Dummy", ServiceOperationResultKind.Void, null, null, "POST", new ServiceOperationParameter[] { parameter });
                return operation;
            }
            else if (type == typeof(ServiceOperationParameter))
            {
                return new ServiceOperationParameter("o", ResourceType.GetPrimitiveResourceType(typeof(string)));
            }
            else if (type == typeof(ResourceSet))
            {
                ResourceProperty p = new ResourceProperty("ID", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, ResourceType.GetPrimitiveResourceType(typeof(int)));

                ResourceType resourceType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "Foo", "NoBaseType", false);
                resourceType.AddProperty(p);
                return new ResourceSet("Customers", resourceType);
            }

            throw new Exception(String.Format("Unexpected type encountered: '{0}'", type.FullName));
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:40,代码来源:ResourceTypeUtils.cs


示例6: IsAssignableFrom

        /// <summary>
        /// Checks if the given type is assignable to this type. In other words, if this type
        /// is a subtype of the given type or not.
        /// </summary>
        /// <param name="subType">resource type to check.</param>
        /// <returns>true, if the given type is assignable to this type. Otherwise returns false.</returns>
        internal static bool IsAssignableFrom(this ResourceType thisType, ResourceType subType)
        {
            CollectionResourceType thisCollectionType = thisType as CollectionResourceType;
            CollectionResourceType subCollectionType = subType as CollectionResourceType;
            if (thisCollectionType != null && subCollectionType != null)
            {
                return thisCollectionType.ItemType.IsAssignableFrom(subCollectionType.ItemType);
            }

            EntityCollectionResourceType thisEntityCollectionType = thisType as EntityCollectionResourceType;
            EntityCollectionResourceType subEntityCollectionType = subType as EntityCollectionResourceType;
            if (thisEntityCollectionType != null && subEntityCollectionType != null)
            {
                return thisEntityCollectionType.ItemType.IsAssignableFrom(subEntityCollectionType.ItemType);
            }

            while (subType != null)
            {
                if (subType == thisType)
                {
                    return true;
                }

                subType = subType.BaseType;
            }

            return false;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:34,代码来源:ResourceTypeAnnotation.cs


示例7: SetupTestMetadata

 private static void SetupTestMetadata(Type entityClrType, Type[] primitiveTypes, out ResourceType entityResourceType, out ProviderMetadataSimulator workspace, out PrimitiveResourceTypeMap primitiveTypeMap)
 {
     KeyValuePair<Type, string>[] mappedPrimitiveTypes = BuildTypeMap(primitiveTypes);
     primitiveTypeMap = new PrimitiveResourceTypeMap(mappedPrimitiveTypes.ToArray());
     entityResourceType = new ResourceType(entityClrType, ResourceTypeKind.EntityType, null, entityClrType.Namespace, entityClrType.Name, false);
     workspace = new ProviderMetadataSimulator(new List<Type>() { entityClrType });
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:7,代码来源:ObjectContextServiceProvider_MetadataTests.cs


示例8: DataServiceProviderWrapperShouldFailOnMultipleActionsWithSameNameAndBindingType

        public void DataServiceProviderWrapperShouldFailOnMultipleActionsWithSameNameAndBindingType()
        {
            var entityType = new ResourceType(typeof(object), ResourceTypeKind.EntityType, null, "Fake.NS", "Type", false) { CanReflectOnInstanceType = false };
            entityType.AddProperty(new ResourceProperty("Id", ResourcePropertyKind.Key | ResourcePropertyKind.Primitive, ResourceType.GetPrimitiveResourceType(typeof(int))) {CanReflectOnInstanceTypeProperty = false});
            entityType.SetReadOnly();

            var resourceSet = new ResourceSet("MyEntitySet", entityType);
            resourceSet.SetReadOnly();

            ResourceType stringType = ResourceType.GetPrimitiveResourceType(typeof(string));
            var duplicateAction1 = new ServiceAction("Duplicate", stringType, OperationParameterBindingKind.Always, new[] { new ServiceActionParameter("p1", entityType), new ServiceActionParameter("p2", stringType) }, null);
            duplicateAction1.SetReadOnly();
            var duplicateAction2 = new ServiceAction("Duplicate", ResourceType.GetPrimitiveResourceType(typeof(int)), OperationParameterBindingKind.Sometimes, new[] { new ServiceActionParameter("p1", entityType) }, null);
            duplicateAction2.SetReadOnly();

            var actionProvider = new TestActionProvider
            {
                GetServiceActionsCallback = ctx => new[] { duplicateAction1, duplicateAction2 }
            };

            var providerWrapper = CreateProviderWrapper(actionProvider, p => p.AddResourceSet(resourceSet));

            Action getVisibleOperations = () => providerWrapper.GetVisibleOperations().ToList();
            getVisibleOperations.ShouldThrow<DataServiceException>()
                .WithMessage(ErrorStrings.DataServiceActionProviderWrapper_DuplicateAction("Duplicate"))
                .And.StatusCode.Should().Be(500);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:27,代码来源:DataServiceProviderWrapperTests.cs


示例9: ServiceActionResolverArgs

        /// <summary>
        /// Initializes a new instance of <see cref="ServiceActionResolverArgs"/>.
        /// </summary>
        /// <param name="serviceActionName"> The service action name taken from the URI.</param>
        /// <param name="bindingType">The binding type based on interpreting the URI preceeding the action, or null if the action is being invoked from the root of the service.</param>
        public ServiceActionResolverArgs(string serviceActionName, ResourceType bindingType)
        {
            WebUtil.CheckStringArgumentNullOrEmpty(serviceActionName, "serviceActionName");
            this.ServiceActionName = serviceActionName;

            // binding type is explicitly allowed to be null.
            this.BindingType = bindingType;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:IDataServiceActionResolver.cs


示例10: DSPResource

 /// <summary>Constructor, creates a new resource with preinitialized properties.</summary>
 /// <param name="resourceType">The type of the resource to create.</param>
 /// <param name="values">The properties to initialize.</param>
 public DSPResource(ResourceType resourceType, IEnumerable<KeyValuePair<string, object>> values)
     : this(resourceType)
 {
     foreach (var value in values)
     {
         this.properties.Add(value.Key, value.Value);
     }
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:11,代码来源:DSPResource.cs


示例11: MetadataProviderEdmCollectionType

        /// <summary>
        /// Initializes a new instance of <see cref="MetadataProviderEdmCollectionType"/>.
        /// </summary>
        /// <param name="collectionResourceType">The collection resource type this edm collection type is being created for.</param>
        /// <param name="elementType">The element type of the collection.</param>
        public MetadataProviderEdmCollectionType(ResourceType collectionResourceType, IEdmTypeReference elementType)
            : base(elementType)
        {
            Debug.Assert(collectionResourceType != null, "collectionResourceType != null");
            Debug.Assert(collectionResourceType is CollectionResourceType || collectionResourceType is EntityCollectionResourceType, "resource type must represent a collection.");

            this.ResourceType = collectionResourceType;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:MetadataProviderEdmCollectionType.cs


示例12: ServiceOperationParameter

 /// <summary>Creates a new instance of <see cref="T:Microsoft.OData.Service.Providers.ServiceOperationParameter" />.</summary>
 /// <param name="name">Name of parameter.</param>
 /// <param name="parameterType">Data type of parameter.</param>
 public ServiceOperationParameter(string name, ResourceType parameterType)
     : base(name, parameterType)
 {
     WebUtil.CheckArgumentNull(parameterType, "parameterType");
     if (parameterType.ResourceTypeKind != ResourceTypeKind.Primitive)
     {
         throw new ArgumentException(Strings.ServiceOperationParameter_TypeNotSupported(name, parameterType.FullName), "parameterType");
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:12,代码来源:ServiceOperationParameter.cs


示例13: GetServiceActionsByBindingParameterType

        public IEnumerable<ServiceAction> GetServiceActionsByBindingParameterType(DataServiceOperationContext operationContext, ResourceType bindingParameterType)
        {
            if (this.GetByBindingTypeCallback != null)
            {
                return this.GetByBindingTypeCallback(operationContext, bindingParameterType);
            }

            throw new NotImplementedException();
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:9,代码来源:TestActionProvider.cs


示例14: EntityToSerialize

        /// <summary>
        /// Initializes a new instance of the <see cref="EntityToSerialize"/> class.
        /// </summary>
        /// <param name="entity">The entity itself.</param>
        /// <param name="resourceType">The type of the entity.</param>
        /// <param name="serializedKey">The serialized entity key for the instance.</param>
        private EntityToSerialize(object entity, ResourceType resourceType, SerializedEntityKey serializedKey)
        {
            Debug.Assert(entity != null, "resource != null");
            Debug.Assert(resourceType != null && resourceType.ResourceTypeKind == ResourceTypeKind.EntityType, "resourceType != null && resourceType.ResourceTypeKind == ResourceTypeKind.EntityType");
            Debug.Assert(serializedKey != null, "serializedKey != null");

            this.entity = entity;
            this.resourceType = resourceType;
            this.serializedEntityKey = serializedKey;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:EntityToSerialize.cs


示例15: GetCacheKey

        /// <summary>
        /// Creates a cache-key from the operation name and binding parameter type.
        /// </summary>
        /// <param name="operationName">The operation name.</param>
        /// <param name="bindingType">The binding parameter type.</param>
        /// <returns>The cache-key.</returns>
        private static string GetCacheKey(string operationName, ResourceType bindingType)
        {
            var cacheKey = operationName;
            if (bindingType != null)
            {
                cacheKey += "_" + bindingType.FullName;
            }

            return cacheKey;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:OperationCache.cs


示例16: LazyResourceType

 /// <summary>
 /// Initializes a new instance of the LazyResourceType class
 /// </summary>
 /// <param name="instanceType">Instance type that will back this metadata type</param>
 /// <param name="resourceTypeKind">The Type, complex or Resource</param>
 /// <param name="baseType">BaseType of the ResourceTYpe</param>
 /// <param name="namespaceName">Namespace of the type</param>
 /// <param name="name">Name of the type</param>
 /// <param name="isAbstract">Whether the type is abstract or not</param>
 public LazyResourceType(
     Type instanceType, 
     ResourceTypeKind resourceTypeKind, 
     ResourceType baseType,
     string namespaceName, 
     string name, 
     bool isAbstract)
     : base(instanceType, resourceTypeKind, baseType, namespaceName, name, isAbstract)
 {
     this.LazyProperties = new List<ResourceProperty>();
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:20,代码来源:LazyResourceType.cs


示例17: EmptyOpenTypesContext

 public EmptyOpenTypesContext()
 {
     this.resourceType = new ResourceType(typeof(StubTypeWithId), ResourceTypeKind.EntityType, null, "OpenTypes", "Entity", false);
     this.resourceType.CanReflectOnInstanceType = true;
     this.resourceType.IsOpenType = true;
     var idProperty = new ResourceProperty("Id", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, ResourceType.GetPrimitiveResourceType(typeof(int)));
     idProperty.CanReflectOnInstanceTypeProperty = true;
     this.resourceType.AddProperty(idProperty);
     this.resourceSet = new ResourceSet("Entities", this.resourceType);
     this.resourceSet.SetReadOnly();
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:11,代码来源:EmptyOpenTypesContext.cs


示例18: ResourceAssociationTypeEnd

 /// <summary>
 /// Creates a new instance of EndInfo.
 /// </summary>
 /// <param name="name">name of the end.</param>
 /// <param name="resourceType">resource type that the end refers to.</param>
 /// <param name="resourceProperty">property of the end.</param>
 /// <param name="multiplicity">Multiplicity of the association.</param>
 /// <param name="deleteBehavior">Delete behavior.</param>
 internal ResourceAssociationTypeEnd(string name, ResourceType resourceType, ResourceProperty resourceProperty, string multiplicity, EdmOnDeleteAction deleteBehavior)
 {
     Debug.Assert(!String.IsNullOrEmpty(name), "!String.IsNullOrEmpty(name)");
     Debug.Assert(resourceType != null, "type != null");
     Debug.Assert(multiplicity == XmlConstants.Many || multiplicity == XmlConstants.One || multiplicity == XmlConstants.ZeroOrOne, "Invalid multiplicity value");
     Debug.Assert(deleteBehavior == EdmOnDeleteAction.None || deleteBehavior == EdmOnDeleteAction.Cascade, "Invalid deleteBehavior value");
     this.name = name;
     this.resourceType = resourceType;
     this.resourceProperty = resourceProperty;
     this.multiplicity = multiplicity;
     this.deleteAction = deleteBehavior;
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:20,代码来源:ResourceAssociationTypeEnd.cs


示例19: EntityCollectionResourceType

        /// <summary>Constructor.</summary>
        /// <param name="itemType">Resource type of a single item in the collection.</param>
        internal EntityCollectionResourceType(ResourceType itemType)
            : base(GetInstanceType(itemType), ResourceTypeKind.EntityCollection, string.Empty, GetName(itemType))
        {
            Debug.Assert(itemType != null, "itemType != null");

            if (itemType.ResourceTypeKind != ResourceTypeKind.EntityType)
            {
                throw new ArgumentException(Strings.ResourceType_CollectionItemCanBeOnlyEntity);
            }

            this.itemType = itemType;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:14,代码来源:EntityCollectionResourceType.cs


示例20: VerifyVersionOfEntityWithGeographyPropertyIsV3

        public void VerifyVersionOfEntityWithGeographyPropertyIsV3()
        {
            ResourceType rt = new ResourceType(typeof(IDictionary<string, string>), ResourceTypeKind.EntityType, null, "TestNamespace", "TestEntity", false);
            var keyProperty = new ResourceProperty("ID", ResourcePropertyKind.Primitive | ResourcePropertyKind.Key, ResourceType.GetPrimitiveResourceType(typeof(int))) {CanReflectOnInstanceTypeProperty = false };
            var geographyProperty = new ResourceProperty("GeographyProperty", ResourcePropertyKind.Primitive, ResourceType.GetPrimitiveResourceType(typeof(Geography))) { CanReflectOnInstanceTypeProperty = false };
            rt.AddProperty(keyProperty);
            rt.AddProperty(geographyProperty);
            rt.SetReadOnly();

            Assert.AreEqual(v4, rt.MetadataVersion, "MetadataVersion must be 4.0");
            Assert.AreEqual(MetadataEdmSchemaVersion.Version4Dot0, rt.SchemaVersion, "Schema version must be 4.0");
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:ResourceTypeTests.cs



注:本文中的Microsoft.OData.Service.Providers.ResourceType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Excel.Application类代码示例发布时间:2022-05-26
下一篇:
C# Library.EdmModel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap