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

C# IEdmElement类代码示例

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

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



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

示例1: EdmDirectValueAnnotationBinding

		public EdmDirectValueAnnotationBinding(IEdmElement element, string namespaceUri, string name)
		{
			EdmUtil.CheckArgumentNull<IEdmElement>(element, "element");
			EdmUtil.CheckArgumentNull<string>(namespaceUri, "namespaceUri");
			EdmUtil.CheckArgumentNull<string>(name, "name");
			this.element = element;
			this.namespaceUri = namespaceUri;
			this.name = name;
		}
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:EdmDirectValueAnnotationBinding.cs


示例2: SetODataAnnotation

 internal static void SetODataAnnotation(this IEdmModel model, IEdmElement annotatable, string localName, string value)
 {
     IEdmStringValue value2 = null;
     if (value != null)
     {
         value2 = new EdmStringConstant(EdmCoreModel.Instance.GetString(true), value);
     }
     model.SetAnnotationValue(annotatable, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", localName, value2);
 }
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:MetadataUtils.cs


示例3: GetAttachedAnnotations

        protected override IEnumerable<IEdmDirectValueAnnotation> GetAttachedAnnotations(IEdmElement element)
        {
            CsdlSemanticsElement csdlElement = element as CsdlSemanticsElement;
            if (csdlElement != null)
            {
                return csdlElement.DirectValueAnnotations;
            }

            return Enumerable.Empty<IEdmDirectValueAnnotation>();
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:10,代码来源:CsdlSemanticsDirectValueAnnotationsManager.cs


示例4: GetODataAnnotations

 internal static IEnumerable<IEdmDirectValueAnnotation> GetODataAnnotations(this IEdmModel model, IEdmElement annotatable)
 {
     IEnumerable<IEdmDirectValueAnnotation> enumerable = model.DirectValueAnnotations(annotatable);
     if (enumerable == null)
     {
         return null;
     }
     return (from a in enumerable
         where a.NamespaceUri == "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
         select a);
 }
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:MetadataUtils.cs


示例5: SetImmediateAnnotations

        private void SetImmediateAnnotations(IEdmElement edmAnnotatable, IEdmElement stockAnnotatable, IEdmModel edmModel, EdmModel stockModel)
        {
            IEnumerable<IEdmDirectValueAnnotation> annotations = edmModel.DirectValueAnnotations(edmAnnotatable);

            foreach (IEdmDirectValueAnnotation annotation in annotations)
            {
                var annotationValue = annotation.Value;
                string annotationNamespace = annotation.NamespaceUri;
                string annotationName = annotation.Name;
                stockModel.SetAnnotationValue(stockAnnotatable, annotationNamespace, annotationName, annotationValue);
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:EdmToStockModelConverter.cs


示例6: Annotate

 public void Annotate(IMetadataElement metadataElement, IEdmElement edmElement, IEdmModel edmModel)
 {
     if (metadataElement is EntityElement || metadataElement is EnumTypeElement)
     {
         var typeName = metadataElement.Identity.Id.Segments.Last();
         var clrType = _clrTypes.SingleOrDefault(x => x.Name.Equals(typeName, StringComparison.OrdinalIgnoreCase));
         if (clrType != null)
         {
             edmModel.SetAnnotationValue(edmElement, new ClrTypeAnnotation(clrType));
         }
     }
 }
开发者ID:2gis,项目名称:nuclear-river,代码行数:12,代码来源:EdmModelAnnotator.cs


示例7: Annotate

        public void Annotate(IMetadataElement metadataElement, IEdmElement edmElement, IEdmModel edmModel)
        {
            if (metadataElement is EntityElement || metadataElement is EnumTypeElement)
            {
                edmModel.SetAnnotationValue(edmElement, AnnotationNamespace, AnnotationAttribute, metadataElement.Identity.Id);

                var clrType = _clrTypeProvider.Get(metadataElement.Identity);
                if (clrType != null)
                {
                    edmModel.SetAnnotationValue(edmElement, new ClrTypeAnnotation(clrType));
                }
            }
        }
开发者ID:2gis,项目名称:nuclear-river,代码行数:13,代码来源:EdmModelAnnotator.cs


示例8: GetODataAnnotations

        /// <summary>
        /// Gets all the serializable annotations in the OData metadata namespace on the <paramref name="annotatable"/>.
        /// </summary>
        /// <param name="model">The <see cref="IEdmModel"/> containing the annotations."/></param>
        /// <param name="annotatable">The <see cref="IEdmElement"/> to get the annotations from.</param>
        /// <returns>All annotations in the OData metadata namespace; or null if no annotations are found.</returns>
        internal static IEnumerable<IEdmDirectValueAnnotation> GetODataAnnotations(this IEdmModel model, IEdmElement annotatable)
        {
            Debug.Assert(model != null, "model != null");
            Debug.Assert(annotatable != null, "annotatable != null");
            
            IEnumerable<IEdmDirectValueAnnotation> annotations = model.DirectValueAnnotations(annotatable);
            if (annotations == null)
            {
                return null;
            }

            return annotations.Where(a => a.NamespaceUri == AtomConstants.ODataMetadataNamespace);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:19,代码来源:MetadataUtils.cs


示例9: GetMimeType

 public static string GetMimeType(this IEdmModel model, IEdmElement annotatable)
 {
     string str;
     ExceptionUtils.CheckArgumentNotNull<IEdmModel>(model, "model");
     ExceptionUtils.CheckArgumentNotNull<IEdmElement>(annotatable, "annotatable");
     if (!model.TryGetODataAnnotation(annotatable, "MimeType", out str))
     {
         return null;
     }
     if (str == null)
     {
         throw new ODataException(Microsoft.Data.OData.Strings.ODataUtils_NullValueForMimeTypeAnnotation);
     }
     return str;
 }
开发者ID:nickchal,项目名称:pash,代码行数:15,代码来源:ODataUtils.cs


示例10: SetODataAnnotation

        /// <summary>
        /// Sets the annotation with the OData metadata namespace and the specified <paramref name="localName" /> on the <paramref name="annotatable"/>.
        /// </summary>
        /// <param name="model">The <see cref="IEdmModel"/> containing the annotations."/></param>
        /// <param name="annotatable">The <see cref="IEdmElement"/> to set the annotation on.</param>
        /// <param name="localName">The local name of the annotation to set.</param>
        /// <param name="value">The value of the annotation to set.</param>
        internal static void SetODataAnnotation(this IEdmModel model, IEdmElement annotatable, string localName, string value)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(model != null, "model != null"); 
            Debug.Assert(annotatable != null, "annotatable != null");
            Debug.Assert(!string.IsNullOrEmpty(localName), "!string.IsNullOrEmpty(localName)");

            IEdmStringValue stringValue = null;
            if (value != null)
            {
                IEdmStringTypeReference typeReference = EdmCoreModel.Instance.GetString(/*nullable*/true);
                stringValue = new EdmStringConstant(typeReference, value);
            }

            model.SetAnnotationValue(annotatable, AtomConstants.ODataMetadataNamespace, localName, stringValue);
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:23,代码来源:MetadataUtils.cs


示例11: ConvertToStockVocabularyAnnotatable

        private IEdmVocabularyAnnotatable ConvertToStockVocabularyAnnotatable(IEdmElement edmAnnotatable, EdmModel stockModel)
        {
            // TODO: Need to provide a better way to get more details on IEdmVocabularyAnnotation.Target.
            IEdmVocabularyAnnotatable stockAnnotatable = null;
            if (edmAnnotatable is IEdmEntityType)
            {
                var edmEntityType = edmAnnotatable as IEdmEntityType;
                stockAnnotatable = stockModel.FindType(edmEntityType.FullName()) as IEdmVocabularyAnnotatable;
                ExceptionUtilities.CheckObjectNotNull(stockAnnotatable, "The FindType method must be successful.");
            }
            else if (edmAnnotatable is IEdmProperty)
            {
                var edmProperty = edmAnnotatable as IEdmProperty;
                if (edmProperty.DeclaringType is IEdmSchemaElement)
                {
                    var stockSchemaElement = stockModel.FindType(((IEdmSchemaElement)edmProperty.DeclaringType).FullName());
                    ExceptionUtilities.CheckObjectNotNull(stockAnnotatable, "The FindType method must be successful.");
                    stockAnnotatable = ((IEdmStructuredType)stockSchemaElement).FindProperty(edmProperty.Name);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            else if (edmAnnotatable is IEdmEntitySet)
            {
                var edmEntitySet = edmAnnotatable as IEdmEntitySet;
                // TODO: No backpointer to the Entity Container from EntitySet in the API. Is this OK?
                stockAnnotatable = stockModel.EntityContainer.EntitySets().Single(m => m.Name == edmEntitySet.Name);
            }
            else if (edmAnnotatable is IEdmEnumType)
            {
                var edmEnumType = edmAnnotatable as IEdmEnumType;
                stockAnnotatable = stockModel.FindType(edmEnumType.FullName());
            }
            else
            {
                throw new NotImplementedException();
            }

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


示例12: GetDirectValueAnnotations

        /// <summary>
        /// Gets annotations associated with an element.
        /// </summary>
        /// <param name="element">The annotated element.</param>
        /// <returns>The immediate value annotations for the element.</returns>
        public IEnumerable<IEdmDirectValueAnnotation> GetDirectValueAnnotations(IEdmElement element)
        {
            // Fetch the annotations dictionary once and only once, because this.annotationsDictionary might get updated by another thread.
            VersioningDictionary<IEdmElement, object> annotationsDictionary = this.annotationsDictionary;

            IEnumerable<IEdmDirectValueAnnotation> immutableAnnotations = this.GetAttachedAnnotations(element);
            object transientAnnotations = GetTransientAnnotations(element, annotationsDictionary);

            if (immutableAnnotations != null)
            {
                foreach (IEdmDirectValueAnnotation existingAnnotation in immutableAnnotations)
                {
                    if (!IsDead(existingAnnotation.NamespaceUri, existingAnnotation.Name, transientAnnotations))
                    {
                        yield return existingAnnotation;
                    }
                }
            }

            foreach (IEdmDirectValueAnnotation existingAnnotation in TransientAnnotations(transientAnnotations))
            {
                yield return existingAnnotation;
            }
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:29,代码来源:EdmDirectValueAnnotationsManager.cs


示例13: TryGetODataAnnotation

        /// <summary>
        /// Returns the annotation in the OData metadata namespace with the specified <paramref name="localName" />.
        /// </summary>
        /// <param name="model">The <see cref="IEdmModel"/> containing the annotation.</param>
        /// <param name="annotatable">The <see cref="IEdmElement"/> to get the annotation from.</param>
        /// <param name="localName">The local name of the annotation to find.</param>
        /// <param name="value">The value of the annotation in the OData metadata namespace and with the specified <paramref name="localName"/>.</param>
        /// <returns>true if an annotation with the specified local name was found; otherwise false.</returns>
        internal static bool TryGetODataAnnotation(this IEdmModel model, IEdmElement annotatable, string localName, out string value)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(model != null, "model != null"); 
            Debug.Assert(annotatable != null, "annotatable != null");
            Debug.Assert(!string.IsNullOrEmpty(localName), "!string.IsNullOrEmpty(localName)");

            object annotationValue = model.GetAnnotationValue(annotatable, AtomConstants.ODataMetadataNamespace, localName);
            if (annotationValue == null)
            {
                value = null;
                return false;
            }

            IEdmStringValue annotationStringValue = annotationValue as IEdmStringValue;
            if (annotationStringValue == null)
            {
                // invalid annotation type found
                throw new ODataException(Strings.ODataAtomWriterMetadataUtils_InvalidAnnotationValue(localName, annotationValue.GetType().FullName));
            }

            value = annotationStringValue.Value;
            return true;
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:32,代码来源:MetadataUtils.cs


示例14: GetDirectValueAnnotations

 public IEnumerable<IEdmDirectValueAnnotation> GetDirectValueAnnotations(IEdmElement element)
 {
     throw new NotImplementedException();
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:4,代码来源:ODataEntityTypeSerializerTests.cs


示例15: SetAnnotationValue

 public void SetAnnotationValue(IEdmElement element, string namespaceName, string localName, object value)
 {
     annotations[CreateKey(element, namespaceName, localName)] = value;
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:4,代码来源:ODataEntityTypeSerializerTests.cs


示例16: GetAnnotationValue

        /// <summary>
        /// Retrieves an annotation value for an EDM element. Returns null if no annotation with the given name exists for the given element.
        /// </summary>
        /// <param name="element">The annotated element.</param>
        /// <param name="namespaceName">Namespace that the annotation belongs to.</param>
        /// <param name="localName">Local name of the annotation.</param>
        /// <returns>Returns the annotation that corresponds to the provided name. Returns null if no annotation with the given name exists for the given element.</returns>
        public object GetAnnotationValue(IEdmElement element, string namespaceName, string localName)
        {
            // Fetch the annotations dictionary once and only once, because this.annotationsDictionary might get updated by another thread.
            VersioningDictionary<IEdmElement, object> annotationsDictionary = this.annotationsDictionary;

            return this.GetAnnotationValue(element, namespaceName, localName, annotationsDictionary);
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:14,代码来源:EdmDirectValueAnnotationsManager.cs


示例17: GetAnnotationValue

            public object GetAnnotationValue(IEdmElement element, string namespaceName, string localName)
            {
                object value;

                if (!annotations.TryGetValue(CreateKey(element, namespaceName, localName), out value))
                {
                    return null;
                }

                return value;
            }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:11,代码来源:ODataEntityTypeSerializerTests.cs


示例18: IsBad

 /// <summary>
 /// Method returns true if the <paramref name="element"/> is known to have structural errors associated with it.
 /// </summary>
 /// <param name="element">The element to test.</param>
 /// <returns>True if the <paramref name="element"/> has structural errors associated with it.</returns>
 public bool IsBad(IEdmElement element)
 {
     return this.isBad(element);
 }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:9,代码来源:ValidationContext.cs


示例19: StoreGeneratedPatternAnnotation

 public StoreGeneratedPatternAnnotation(IEdmElement element, DatabaseGeneratedOption option)
 {
     this.element = element;
     this.value = new EdmStringConstant(EdmCoreModel.Instance.GetString(isNullable: false), option.ToString());
 }
开发者ID:AndreGleichner,项目名称:aspnetwebstack,代码行数:5,代码来源:StoreGeneratedPatternAnnotation.cs


示例20: SetAnnotationValue

        /// <summary>
        /// Sets an annotation value for an EDM element. If the value is null, no annotation is added and an existing annotation with the same name is removed.
        /// </summary>
        /// <param name="element">The annotated element.</param>
        /// <param name="namespaceName">Namespace that the annotation belongs to.</param>
        /// <param name="localName">Name of the annotation within the namespace.</param>
        /// <param name="value">New annotation to set.</param>
        public void SetAnnotationValue(IEdmElement element, string namespaceName, string localName, object value)
        {
            lock (this.annotationsDictionaryLock)
            {
                // Use a local variable to store any interim changes to the annotations dictionary, and perform one atomic update
                // to the field. Otherwise, other threads could see a dictionary in an interim state.
                VersioningDictionary<IEdmElement, object> annotationsDictionary = this.annotationsDictionary;
                this.SetAnnotationValue(element, namespaceName, localName, value, ref annotationsDictionary);

                this.annotationsDictionary = annotationsDictionary;
            }
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:19,代码来源:EdmDirectValueAnnotationsManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IEdmEntitySet类代码示例发布时间:2022-05-24
下一篇:
C# IEditorService类代码示例发布时间: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