示例#1
0
 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);
 }
示例#2
0
        /// <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);
        }
示例#3
0
 private static IEdmDirectValueAnnotationBinding GetODataAnnotationBinding(IEdmElement annotatable, string localName, string value)
 {
     IEdmStringValue value2 = null;
     if (value != null)
     {
         value2 = new EdmStringConstant(EdmCoreModel.Instance.GetString(true), value);
     }
     return new EdmDirectValueAnnotationBinding(annotatable, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", localName, value2);
 }
        /// <summary>
        /// Gets the annotation binding with the OData metadata namespace and the specified <paramref name="localName" /> for the <paramref name="annotatable"/>.
        /// </summary>
        /// <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>
        /// <returns>An <see cref="IEdmDirectValueAnnotationBinding"/> instance that represnets the annotation with the specified name and value.</returns>
        private static IEdmDirectValueAnnotationBinding GetODataAnnotationBinding(IEdmElement annotatable, string localName, string value)
        {
            DebugUtils.CheckNoExternalCallers();
            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);
            }

            return new EdmDirectValueAnnotationBinding(annotatable, AtomConstants.ODataMetadataNamespace, localName, stringValue);
        }
		private IEdmValue ComputeValue()
		{
			IEdmStringValue edmStringConstant = new EdmStringConstant(new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), false), this.annotation.Value);
			edmStringConstant.SetIsSerializedAsElement(this.model, !this.annotation.IsAttribute);
			return edmStringConstant;
		}