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

C# IEdmType类代码示例

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

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



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

示例1: GetMatchedOperations

        private static IEnumerable<IEdmOperation> GetMatchedOperations(this IEnumerable<IEdmOperation> operations,
            string operationIdentifier, IEdmType bindingType)
        {
            Contract.Assert(operations != null);
            Contract.Assert(operationIdentifier != null);
            Contract.Assert(bindingType != null);

            string[] nameParts = operationIdentifier.Split('.');
            Contract.Assert(nameParts.Length != 0);

            if (nameParts.Length == 1)
            {
                // Name
                string name = nameParts[0];
                operations = operations.Where(f => f.Name == name);
            }
            else
            {
                // Namespace.Name
                string name = nameParts[nameParts.Length - 1];
                string nspace = String.Join(".", nameParts.Take(nameParts.Length - 1));
                operations = operations.Where(f => f.Name == name && f.Namespace == nspace);
            }

            return operations.Where(procedure => procedure.CanBindTo(bindingType));
        }
开发者ID:modulexcite,项目名称:aspnetwebstack-1,代码行数:26,代码来源:ProcedureHelpers.cs


示例2: SetClientTypeAnnotation

 /// <summary>
 /// Sets the single instance of <see cref="ClientTypeAnnotation"/> on the given instance of <paramref name="edmType"/>.
 /// </summary>
 /// <param name="model">The model the <paramref name="edmType"/> belongs to.</param>
 /// <param name="edmType">IEdmType instance to set the annotation on.</param>
 /// <param name="annotation">The annotation to set</param>
 internal static void SetClientTypeAnnotation(this IEdmModel model, IEdmType edmType, ClientTypeAnnotation annotation)
 {
     Debug.Assert(model != null, "model != null");
     Debug.Assert(edmType != null, "edmType != null");
     Debug.Assert(annotation != null, "annotation != null");
     model.SetAnnotationValue<ClientTypeAnnotation>(edmType, annotation);
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:13,代码来源:ClientTypeUtil.cs


示例3: GetClientTypeAnnotation

        /// <summary>
        /// Gets the single instance of <see cref="ClientTypeAnnotation"/> from the given instance of <paramref name="edmType"/>.
        /// </summary>
        /// <param name="model">The model the <paramref name="edmType"/> belongs to.</param>
        /// <param name="edmType">IEdmType instance to get the annotation.</param>
        /// <returns>Returns the single instance of <see cref="ClientTypeAnnotation"/> from the given instance of <paramref name="edmType"/>.</returns>
        internal static ClientTypeAnnotation GetClientTypeAnnotation(this IEdmModel model, IEdmType edmType)
        {
            Debug.Assert(model != null, "model != null");
            Debug.Assert(edmType != null, "edmType != null");

            return model.GetAnnotationValue<ClientTypeAnnotation>(edmType);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:13,代码来源:ClientTypeUtil.cs


示例4: GetPropertyType

 private static IEdmTypeReference GetPropertyType(IEdmType type, string propertyName)
 {
     IEdmStructuredType type2 = type as IEdmStructuredType;
     IEdmProperty property = (type2 == null) ? null : type2.FindProperty(propertyName);
     if (property != null)
     {
         IEdmTypeReference typeReference = property.Type;
         if (typeReference.IsNonEntityODataCollectionTypeKind())
         {
             throw new ODataException(Microsoft.Data.OData.Strings.EpmSourceTree_CollectionPropertyCannotBeMapped(propertyName, type.ODataFullName()));
         }
         if (typeReference.IsStream())
         {
             throw new ODataException(Microsoft.Data.OData.Strings.EpmSourceTree_StreamPropertyCannotBeMapped(propertyName, type.ODataFullName()));
         }
         if (typeReference.IsSpatial())
         {
             throw new ODataException(Microsoft.Data.OData.Strings.EpmSourceTree_SpatialTypeCannotBeMapped(propertyName, type.ODataFullName()));
         }
         return property.Type;
     }
     if ((type != null) && !type.IsOpenType())
     {
         throw new ODataException(Microsoft.Data.OData.Strings.EpmSourceTree_MissingPropertyOnType(propertyName, type.ODataFullName()));
     }
     return null;
 }
开发者ID:nickchal,项目名称:pash,代码行数:27,代码来源:EpmSourceTree.cs


示例5: ResolveAndValidateNonPrimitiveTargetType

 internal static IEdmTypeReference ResolveAndValidateNonPrimitiveTargetType(EdmTypeKind expectedTypeKind, IEdmTypeReference expectedTypeReference, EdmTypeKind payloadTypeKind, IEdmType payloadType, string payloadTypeName, IEdmModel model, ODataMessageReaderSettings messageReaderSettings, ODataVersion version, out SerializationTypeNameAnnotation serializationTypeNameAnnotation)
 {
     bool flag = (messageReaderSettings.ReaderBehavior.TypeResolver != null) && (payloadType != null);
     if (!flag)
     {
         ValidateTypeSupported(expectedTypeReference, version);
         if (model.IsUserModel() && ((expectedTypeReference == null) || !messageReaderSettings.DisableStrictMetadataValidation))
         {
             VerifyPayloadTypeDefined(payloadTypeName, payloadType);
         }
     }
     else
     {
         ValidateTypeSupported((payloadType == null) ? null : payloadType.ToTypeReference(true), version);
     }
     if ((payloadTypeKind != EdmTypeKind.None) && (!messageReaderSettings.DisableStrictMetadataValidation || (expectedTypeReference == null)))
     {
         ValidationUtils.ValidateTypeKind(payloadTypeKind, expectedTypeKind, payloadTypeName);
     }
     serializationTypeNameAnnotation = null;
     if (!model.IsUserModel())
     {
         return null;
     }
     if ((expectedTypeReference == null) || flag)
     {
         return ResolveAndValidateTargetTypeWithNoExpectedType(expectedTypeKind, payloadType, payloadTypeName, out serializationTypeNameAnnotation);
     }
     if (messageReaderSettings.DisableStrictMetadataValidation)
     {
         return ResolveAndValidateTargetTypeStrictValidationDisabled(expectedTypeKind, expectedTypeReference, payloadType, payloadTypeName, out serializationTypeNameAnnotation);
     }
     return ResolveAndValidateTargetTypeStrictValidationEnabled(expectedTypeKind, expectedTypeReference, payloadType, payloadTypeName, out serializationTypeNameAnnotation);
 }
开发者ID:nickchal,项目名称:pash,代码行数:34,代码来源:ReaderValidationUtils.cs


示例6: ResolveBoundOperations

 public override IEnumerable<IEdmOperation> ResolveBoundOperations(
     IEdmModel model,
     string identifier,
     IEdmType bindingType)
 {
     return unqualified.ResolveBoundOperations(model, identifier, bindingType);
 }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:7,代码来源:Resolvers.cs


示例7: ThrowIfTypesUnrelated

 /// <summary>
 /// Throws if the type is not related to the type of the given set.
 /// </summary>
 /// <param name="type">Type to check.</param>
 /// <param name="secondType">Second type, which should be related to the first type.</param>
 /// <param name="segmentName">The segment that is checking this.</param>
 internal static void ThrowIfTypesUnrelated(IEdmType type, IEdmType secondType, string segmentName)
 {
     if (!UriEdmHelpers.IsRelatedTo(type.AsElementType(), secondType))
     {
         throw new ODataException(Strings.PathParser_TypeMustBeRelatedToSet(type, secondType, segmentName));
     }
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:ExceptionUtil.cs


示例8: EdmTypeReference

        /// <summary>
        /// Initializes a new instance of the <see cref="EdmTypeReference"/> class.
        /// </summary>
        /// <param name="definition">Type that describes this value.</param>
        /// <param name="isNullable">Denotes whether the type can be nullable.</param>
        protected EdmTypeReference(IEdmType definition, bool isNullable)
        {
            EdmUtil.CheckArgumentNull(definition, "definition");

            this.definition = definition;
            this.isNullable = isNullable;
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:12,代码来源:EdmTypeReference.cs


示例9: ShouldBeEquivalentTo

 public static AndConstraint<IEdmType> ShouldBeEquivalentTo(this IEdmType type, IEdmType expectedType)
 {
     type.IsEquivalentTo(expectedType).Should().BeTrue();
     ////typeReference.Should().BeSameAs(expectedTypeReference.Definition);
     ////typeReference.IsNullable.Should().Be(expectedTypeReference.IsNullable);
     return new AndConstraint<IEdmType>(type);
 }
开发者ID:cxlove,项目名称:odata.net,代码行数:7,代码来源:EdmAssertions.cs


示例10: UpdateSchema

        public TypeSchema UpdateSchema(object value, IEdmType edmType, bool collection = false)
        {
            TypeSchema schema = null;
            if (edmType != null)
            {
                try
                {
                    schema = ODataAvroSchemaGen.GetSchemaFromModel(edmType);
                }
                catch (ApplicationException) { }
            }

            if (schema == null)
            {
                if (value == null)
                {
                    return null;
                }

                schema = ODataAvroSchemaGen.GetSchema(value);
            }

            TypeSchema single = AvroSerializer.CreateGeneric(schema.ToString()).WriterSchema;

            if (collection)
            {
                schema = ODataAvroSchemaGen.GetArraySchema(schema);
                single = ((ArraySchema)AvroSerializer.CreateGeneric(schema.ToString()).WriterSchema).ItemSchema;
            }

            var writer = AvroContainer.CreateGenericWriter(schema.ToString(), stream, true, Codec.Null);
            this.seqWriter = new SequentialWriter<object>(writer, 16);

            return single;
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:35,代码来源:AvroWriter.cs


示例11: GetNullablePayloadTypeReference

 private static IEdmTypeReference GetNullablePayloadTypeReference(IEdmType payloadType)
 {
     if (payloadType != null)
     {
         return payloadType.ToTypeReference(true);
     }
     return null;
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:ReaderValidationUtils.cs


示例12: ClientTypeAnnotation

 internal ClientTypeAnnotation(IEdmType edmType, Type type, string qualifiedName, DataServiceProtocolVersion maxProtocolVersion)
 {
     this.EdmType = edmType;
     this.ElementTypeName = qualifiedName;
     this.ElementType = Nullable.GetUnderlyingType(type) ?? type;
     this.MaxProtocolVersion = maxProtocolVersion;
     this.epmLazyLoader = new EpmLazyLoader(this);
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:ClientTypeAnnotation.cs


示例13: ParseAtEntityCollection

 protected override ODataPathSegment ParseAtEntityCollection(IEdmModel model, ODataPathSegment previous, IEdmType previousEdmType, string segment)
 {
     if (segment == "$count")
     {
         return new CountPathSegment();
     }
     return base.ParseAtEntityCollection(model, previous, previousEdmType, segment);
 }
开发者ID:battenworks,项目名称:NuGet.Lucene,代码行数:8,代码来源:CountODataPathHandler.cs


示例14: 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(IEdmType resourceType, IEnumerable<KeyValuePair<string, object>> values)
     : this(resourceType)
 {
     foreach (var value in values)
     {
         this.properties.Add(value.Key, value.Value);
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:11,代码来源:DSPResource.cs


示例15: GetEdmType

 /// <summary>
 /// Gets the EDM type for this segment.
 /// </summary>
 /// <param name="previousEdmType">The EDM type of the previous path segment.</param>
 /// <returns>
 /// The EDM type for this segment.
 /// </returns>
 public override IEdmType GetEdmType(IEdmType previousEdmType)
 {
     if (Property != null)
     {
         return Property.Type.Definition;
     }
     return null;
 }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:15,代码来源:PropertyAccessPathSegment.cs


示例16: GetEdmType

 /// <summary>
 /// Gets the EDM type for this segment.
 /// </summary>
 /// <param name="previousEdmType">The EDM type of the previous path segment.</param>
 /// <returns>
 /// The EDM type for this segment.
 /// </returns>
 public override IEdmType GetEdmType(IEdmType previousEdmType)
 {
     if (EntitySet != null)
     {
         return EntitySet.ElementType.GetCollection();
     }
     return null;
 }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:15,代码来源:EntitySetPathSegment.cs


示例17: GetEdmType

        /// <summary>
        /// Gets the EDM type for this segment.
        /// </summary>
        /// <param name="previousEdmType">The EDM type of the previous path segment.</param>
        /// <returns>
        /// The EDM type for this segment.
        /// </returns>
        public override IEdmType GetEdmType(IEdmType previousEdmType)
        {
            if (EntitySetBase != null)
            {
                return EntitySetBase.EntityType().GetCollection();
            }

            return null;
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:16,代码来源:EntitySetPathSegment.cs


示例18: GetEdmType

 /// <summary>
 /// Gets the EDM type for this segment.
 /// </summary>
 /// <param name="previousEdmType">The EDM type of the previous path segment.</param>
 /// <returns>
 /// The EDM type for this segment.
 /// </returns>
 public override IEdmType GetEdmType(IEdmType previousEdmType)
 {
     IEdmCollectionType previousCollectionType = previousEdmType as IEdmCollectionType;
     if (previousCollectionType != null)
     {
         return previousCollectionType.ElementType.Definition;
     }
     return null;
 }
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:16,代码来源:KeyValuePathSegment.cs


示例19: CheckRelatedTo

 /// <summary>
 /// Check whether the parent and child are properly related types
 /// </summary>
 /// <param name="parentType">the parent type</param>
 /// <param name="childType">the child type</param>
 /// <exception cref="ODataException">Throws if the two types are not related.</exception>
 public static void CheckRelatedTo(IEdmType parentType, IEdmType childType)
 {
     if (!IsRelatedTo(parentType, childType))
     {
         // If the parentType is an open property, parentType will be null and can't have an ODataFullName.
         string parentTypeName = (parentType != null) ? parentType.ODataFullName() : "<null>";
         throw new ODataException(OData.Core.Strings.MetadataBinder_HierarchyNotFollowed(childType.FullTypeName(), parentTypeName));
     }
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:15,代码来源:UriEdmHelpers.cs


示例20: FindMatchedOperations

        public static IEnumerable<IEdmOperation> FindMatchedOperations(this IEdmModel model, string identifier, IEdmType bindingType)
        {
            Contract.Assert(model != null);
            Contract.Assert(identifier != null);
            Contract.Assert(bindingType != null);

            IEnumerable<IEdmOperation> operations = model.SchemaElements.OfType<IEdmOperation>();
            return operations.GetMatchedOperations(identifier, bindingType);
        }
开发者ID:modulexcite,项目名称:aspnetwebstack-1,代码行数:9,代码来源:ProcedureHelpers.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IEdmTypeReference类代码示例发布时间:2022-05-24
下一篇:
C# IEdmStructuredType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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