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

C# Providers.ResourceType类代码示例

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

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



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

示例1: ApplyProperty

 protected void ApplyProperty(ODataProperty property, ResourceType resourceType, object resource)
 {
     ResourceType type;
     string name = property.Name;
     ResourceProperty resourceProperty = resourceType.TryResolvePropertyName(name);
     if (resourceProperty == null)
     {
         type = null;
     }
     else
     {
         if (resourceProperty.Kind == ResourcePropertyKind.Stream)
         {
             return;
         }
         if (base.Update && resourceProperty.IsOfKind(ResourcePropertyKind.Key))
         {
             return;
         }
         type = resourceProperty.ResourceType;
     }
     object propertyValue = this.ConvertValue(property.Value, ref type);
     if (resourceProperty == null)
     {
         Deserializer.SetOpenPropertyValue(resource, name, propertyValue, base.Service);
     }
     else
     {
         Deserializer.SetPropertyValue(resourceProperty, resource, propertyValue, base.Service);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:31,代码来源:ODataMessageReaderDeserializer.cs


示例2: ResourceType

 private ResourceType(Type type, ResourceType baseType, string namespaceName, string name, bool isAbstract)
 {
     this.lockPropertiesLoad = new object();
     this.propertyInfosDeclaredOnThisType = new Dictionary<ResourceProperty, ResourcePropertyInfo>(ReferenceEqualityComparer<ResourceProperty>.Instance);
     this.schemaVersion = ~MetadataEdmSchemaVersion.Version1Dot0;
     WebUtil.CheckArgumentNull<Type>(type, "type");
     WebUtil.CheckArgumentNull<string>(name, "name");
     this.name = name;
     this.namespaceName = namespaceName ?? string.Empty;
     if ((name == "String") && object.ReferenceEquals(namespaceName, "Edm"))
     {
         this.fullName = "Edm.String";
     }
     else
     {
         this.fullName = string.IsNullOrEmpty(namespaceName) ? name : (namespaceName + "." + name);
     }
     this.type = type;
     this.abstractType = isAbstract;
     this.canReflectOnInstanceType = true;
     if (baseType != null)
     {
         this.baseType = baseType;
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:25,代码来源:ResourceType.cs


示例3: AddEntityType

 private IEdmEntityType AddEntityType(ResourceType resourceType, string resourceTypeNamespace)
 {
     Action<MetadataProviderEdmEntityType> propertyLoadAction = delegate (MetadataProviderEdmEntityType type) {
         IEnumerable<ResourceProperty> allVisiblePropertiesDeclaredInThisType = this.GetAllVisiblePropertiesDeclaredInThisType(resourceType);
         if (allVisiblePropertiesDeclaredInThisType != null)
         {
             foreach (ResourceProperty property in allVisiblePropertiesDeclaredInThisType)
             {
                 IEdmProperty property2 = this.CreateProperty(type, property);
                 if (property.IsOfKind(ResourcePropertyKind.Key))
                 {
                     type.AddKeys(new IEdmStructuralProperty[] { (IEdmStructuralProperty) property2 });
                 }
             }
         }
     };
     MetadataProviderEdmEntityType schemaType = new MetadataProviderEdmEntityType(resourceTypeNamespace, resourceType.Name, (resourceType.BaseType != null) ? ((IEdmEntityType) this.EnsureSchemaType(resourceType.BaseType)) : null, resourceType.IsAbstract, resourceType.IsOpenType, propertyLoadAction);
     this.CacheSchemaType(schemaType);
     if (resourceType.IsMediaLinkEntry && ((resourceType.BaseType == null) || !resourceType.BaseType.IsMediaLinkEntry))
     {
         this.SetHasDefaultStream(schemaType, true);
     }
     if (resourceType.HasEntityPropertyMappings)
     {
         MetadataProviderUtils.ConvertEntityPropertyMappings(this, resourceType, schemaType);
     }
     MetadataProviderUtils.ConvertCustomAnnotations(this, resourceType.CustomAnnotations, schemaType);
     return schemaType;
 }
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:MetadataProviderEdmModel.cs


示例4: MovableWhereFinder

		public MovableWhereFinder(Expression tree, IQueryable<DSResource> resourceRoot, ResourceType baseResourceType)
		{
			this.resourceRoot = resourceRoot;
			this.baseResourceType = baseResourceType;
			this.MovableWhereExpression = null;
			this.Visit(tree);
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:MovableWhereFinder.cs


示例5: GetAllEntityProperties

 private IEnumerable<ODataProperty> GetAllEntityProperties(object customObject, ResourceType currentResourceType, Uri relativeUri)
 {
     List<ODataProperty> list = new List<ODataProperty>(currentResourceType.Properties.Count);
     foreach (ResourceProperty property in base.Provider.GetResourceSerializableProperties(base.CurrentContainer, currentResourceType))
     {
         if (property.TypeKind != ResourceTypeKind.EntityType)
         {
             list.Add(this.GetODataPropertyForEntityProperty(customObject, currentResourceType, relativeUri, property));
         }
     }
     if (currentResourceType.IsOpenType)
     {
         foreach (KeyValuePair<string, object> pair in base.Provider.GetOpenPropertyValues(customObject))
         {
             string key = pair.Key;
             if (string.IsNullOrEmpty(key))
             {
                 throw new DataServiceException(500, System.Data.Services.Strings.Syndication_InvalidOpenPropertyName(currentResourceType.FullName));
             }
             list.Add(this.GetODataPropertyForOpenProperty(key, pair.Value));
         }
         if (!currentResourceType.HasEntityPropertyMappings || (this.contentFormat == ODataFormat.VerboseJson))
         {
             return list;
         }
         HashSet<string> propertiesLookup = new HashSet<string>(from p in list select p.Name);
         foreach (EpmSourcePathSegment segment in from p in currentResourceType.EpmSourceTree.Root.SubProperties
             where !propertiesLookup.Contains(p.PropertyName)
             select p)
         {
             list.Add(this.GetODataPropertyForOpenProperty(segment.PropertyName, base.Provider.GetOpenPropertyValue(customObject, segment.PropertyName)));
         }
     }
     return list;
 }
开发者ID:nickchal,项目名称:pash,代码行数:35,代码来源:EntitySerializer.cs


示例6: GetBinaryOperatorResultType

        /// <summary>
        /// Compute the result type of a binary operator based on the type of its operands and the operator kind.
        /// </summary>
        /// <param name="type">The type of the operators.</param>
        /// <param name="operatorKind">The kind of operator.</param>
        /// <returns>The result type of the binary operator.</returns>
        internal static ResourceType GetBinaryOperatorResultType(ResourceType type, BinaryOperatorKind operatorKind)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(type != null, "type != null");

            switch (operatorKind)
            {
                case BinaryOperatorKind.Or:                 // fall through
                case BinaryOperatorKind.And:                // fall through
                case BinaryOperatorKind.Equal:              // fall through
                case BinaryOperatorKind.NotEqual:           // fall through
                case BinaryOperatorKind.GreaterThan:        // fall through
                case BinaryOperatorKind.GreaterThanOrEqual: // fall through
                case BinaryOperatorKind.LessThan:           // fall through
                case BinaryOperatorKind.LessThanOrEqual:
                    Type resultType = Nullable.GetUnderlyingType(type.InstanceType) == null
                        ? typeof(bool)
                        : typeof(bool?);
                    return ResourceType.GetPrimitiveResourceType(resultType);

                case BinaryOperatorKind.Add:        // fall through
                case BinaryOperatorKind.Subtract:   // fall through
                case BinaryOperatorKind.Multiply:   // fall through
                case BinaryOperatorKind.Divide:     // fall through
                case BinaryOperatorKind.Modulo:
                    return type;

                default:
                    throw new ODataException(Strings.General_InternalError(InternalErrorCodes.QueryNodeUtils_BinaryOperatorResultType_UnreachableCodepath));
            }
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:37,代码来源:QueryNodeUtils.cs


示例7: GetCommand

		public ICommand GetCommand(CommandType commandType, UserContext userContext, ResourceType entityType, EntityMetadata entityMetadata, string membershipId)
		{
			if (entityType.Name == "CommandInvocation")
			{
				CommandType commandType1 = commandType;
				switch (commandType1)
				{
					case CommandType.Create:
					case CommandType.Read:
					case CommandType.Delete:
					{
						return new GICommand(commandType, this.runspaceStore, entityType, userContext, membershipId);
					}
					case CommandType.Update:
					{
						throw new NotImplementedException();
					}
					default:
					{
						throw new NotImplementedException();
					}
				}
			}
			else
			{
				throw new NotImplementedException();
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:28,代码来源:GICommandManager.cs


示例8: PrimitiveTypeSerializer

		public PrimitiveTypeSerializer(ResourceType resourceType, ResourceProperty resourceProperty) : base(resourceType)
		{
			object defaultValue;
			object[] resourceTypeKind = new object[2];
			resourceTypeKind[0] = resourceType.ResourceTypeKind;
			resourceTypeKind[1] = ResourceTypeKind.Primitive;
			ExceptionHelpers.ThrowArgumentExceptionIf("resourceType", resourceType.ResourceTypeKind != ResourceTypeKind.Primitive, new ExceptionHelpers.MessageLoader(SerializerBase.GetInvalidArgMessage), resourceTypeKind);
			this.defaultValue = null;
			if (resourceProperty != null)
			{
				if ((resourceProperty.Kind & ResourcePropertyKind.Primitive) != ResourcePropertyKind.Primitive || resourceProperty.ResourceType.InstanceType != resourceType.InstanceType)
				{
					throw new ArgumentException("resourceProperty");
				}
				else
				{
					PropertyCustomState customState = resourceProperty.GetCustomState();
					PrimitiveTypeSerializer primitiveTypeSerializer = this;
					if (customState != null)
					{
						defaultValue = customState.DefaultValue;
					}
					else
					{
						defaultValue = null;
					}
					primitiveTypeSerializer.defaultValue = defaultValue;
					this.name = resourceProperty.Name;
				}
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:31,代码来源:PrimitiveTypeSerializer.cs


示例9: GetDerivedTypes

 public IEnumerable<ResourceType> GetDerivedTypes(
     ResourceType resourceType
 )
 {
     // We don't support type inheritance yet
     yield break;
 } 
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:7,代码来源:DataServiceMetadataProvider.cs


示例10: CollectionResourceTypeSerializer

		public CollectionResourceTypeSerializer(ResourceType resourceType) : base(resourceType)
		{
			object[] resourceTypeKind = new object[2];
			resourceTypeKind[0] = resourceType.ResourceTypeKind;
			resourceTypeKind[1] = ResourceTypeKind.Collection;
			ExceptionHelpers.ThrowArgumentExceptionIf("resourceType", resourceType.ResourceTypeKind != ResourceTypeKind.Collection, new ExceptionHelpers.MessageLoader(SerializerBase.GetInvalidArgMessage), resourceTypeKind);
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:CollectionResourceTypeSerializer.cs


示例11: WriteEntryEpm

        /// <summary>
        /// Writes the custom mapped EPM properties to an XML writer which is expected to be positioned such to write
        /// a child element of the entry element.
        /// </summary>
        /// <param name="writer">The XmlWriter to write to.</param>
        /// <param name="epmTargetTree">The EPM target tree to use.</param>
        /// <param name="epmValueCache">The entry properties value cache to use to access the properties.</param>
        /// <param name="resourceType">The resource type of the entry.</param>
        /// <param name="metadata">The metadata provider to use.</param>
        internal static void WriteEntryEpm(
            XmlWriter writer,
            EpmTargetTree epmTargetTree,
            EntryPropertiesValueCache epmValueCache,
            ResourceType resourceType,
            DataServiceMetadataProviderWrapper metadata)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(writer != null, "writer != null");
            Debug.Assert(epmTargetTree != null, "epmTargetTree != null");
            Debug.Assert(epmValueCache != null, "epmValueCache != null");
            Debug.Assert(resourceType != null, "For any EPM to exist the metadata must be available.");

            // If there are no custom mappings, just return null.
            EpmTargetPathSegment customRootSegment = epmTargetTree.NonSyndicationRoot;
            Debug.Assert(customRootSegment != null, "EPM Target tree must always have non-syndication root.");
            if (customRootSegment.SubSegments.Count == 0)
            {
                return;
            }

            foreach (EpmTargetPathSegment targetSegment in customRootSegment.SubSegments)
            {
                Debug.Assert(!targetSegment.IsAttribute, "Target segments under the custom root must be for elements only.");

                string alreadyDeclaredPrefix = null;
                WriteElementEpm(writer, targetSegment, epmValueCache, resourceType, metadata, ref alreadyDeclaredPrefix);
            }
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:38,代码来源:EpmCustomWriter.cs


示例12: GetPropertyInfo

        /// <summary>
        /// Gets the property info for the resource property declared on this type.
        /// </summary>
        /// <param name="resourceType">The resource type to get the property on.</param>
        /// <param name="resourceProperty">Resource property instance to get the property info for.</param>
        /// <returns>Returns the PropertyInfo object for the specified resource property.</returns>
        internal PropertyInfo GetPropertyInfo(ResourceType resourceType, ResourceProperty resourceProperty)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(resourceProperty != null, "resourceProperty != null");
            Debug.Assert(resourceProperty.CanReflectOnInstanceTypeProperty, "resourceProperty.CanReflectOnInstanceTypeProperty");
            Debug.Assert(resourceType.Properties.Contains(resourceProperty), "The resourceType does not define the specified resourceProperty.");

            if (this.propertyInfosDeclaredOnThisType == null)
            {
                this.propertyInfosDeclaredOnThisType = new Dictionary<ResourceProperty, PropertyInfo>(ReferenceEqualityComparer<ResourceProperty>.Instance);
            }

            PropertyInfo propertyInfo;
            if (!this.propertyInfosDeclaredOnThisType.TryGetValue(resourceProperty, out propertyInfo))
            {
                BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance;
                propertyInfo = resourceType.InstanceType.GetProperty(resourceProperty.Name, bindingFlags);
                if (propertyInfo == null)
                {
                    throw new ODataException(Strings.PropertyInfoResourceTypeAnnotation_CannotFindProperty(resourceType.FullName, resourceType.InstanceType, resourceProperty.Name));
                }

                this.propertyInfosDeclaredOnThisType.Add(resourceProperty, propertyInfo);
            }

            Debug.Assert(propertyInfo != null, "propertyInfo != null");
            return propertyInfo;
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:35,代码来源:PropertyInfoResourceTypeAnnotation.cs


示例13: GetReturnTypeFromResultType

 private static ResourceType GetReturnTypeFromResultType(ResourceType resultType, ServiceOperationResultKind resultKind)
 {
     if (((resultKind == ServiceOperationResultKind.Void) && (resultType != null)) || ((resultKind != ServiceOperationResultKind.Void) && (resultType == null)))
     {
         throw new ArgumentException(System.Data.Services.Strings.ServiceOperation_ResultTypeAndKindMustMatch("resultKind", "resultType", ServiceOperationResultKind.Void));
     }
     if ((resultType != null) && (resultType.ResourceTypeKind == ResourceTypeKind.Collection))
     {
         throw new ArgumentException(System.Data.Services.Strings.ServiceOperation_InvalidResultType(resultType.FullName));
     }
     if ((resultType != null) && (resultType.ResourceTypeKind == ResourceTypeKind.EntityCollection))
     {
         throw new ArgumentException(System.Data.Services.Strings.ServiceOperation_InvalidResultType(resultType.FullName));
     }
     if (resultType == null)
     {
         return null;
     }
     if (((resultType.ResourceTypeKind == ResourceTypeKind.Primitive) || (resultType.ResourceTypeKind == ResourceTypeKind.ComplexType)) && ((resultKind == ServiceOperationResultKind.Enumeration) || (resultKind == ServiceOperationResultKind.QueryWithMultipleResults)))
     {
         return ResourceType.GetCollectionResourceType(resultType);
     }
     if ((resultType.ResourceTypeKind == ResourceTypeKind.EntityType) && ((resultKind == ServiceOperationResultKind.Enumeration) || (resultKind == ServiceOperationResultKind.QueryWithMultipleResults)))
     {
         return ResourceType.GetEntityCollectionResourceType(resultType);
     }
     return resultType;
 }
开发者ID:nickchal,项目名称:pash,代码行数:28,代码来源:ServiceOperation.cs


示例14: Extract

		public bool Extract(Expression tree, IQueryable<DSResource> resourceRoot, ResourceType resourceType, EntityMetadata entityMetadata)
		{
			this.resourceRoot = resourceRoot;
			this.entityMetadata = entityMetadata;
			this.navigationProperty = null;
			this.referredEntityKeys = new Dictionary<string, object>();
			this.referringEntityKeys = new Dictionary<string, object>();
			this.currentState = ReferredResourceExtractor.ExtractionState.ExtractingReferredEntityInfo;
			this.Visit(tree);
			if (this.currentState == ReferredResourceExtractor.ExtractionState.ExtractingReferringEntityInfo)
			{
				DSResource dSResource = ResourceTypeExtensions.CreateKeyOnlyResource(resourceType, this.referringEntityKeys);
				if (dSResource != null)
				{
					this.ReferredResource = ResourceTypeExtensions.CreateKeyOnlyResource(this.navigationProperty.ResourceType, this.referredEntityKeys);
					if (this.ReferredResource != null)
					{
						this.currentState = ReferredResourceExtractor.ExtractionState.ExtractionDone;
					}
				}
			}
			if (this.currentState != ReferredResourceExtractor.ExtractionState.ExtractionDone)
			{
				this.currentState = ReferredResourceExtractor.ExtractionState.ExtractionFailed;
			}
			return this.currentState == ReferredResourceExtractor.ExtractionState.ExtractionDone;
		}
开发者ID:nickchal,项目名称:pash,代码行数:27,代码来源:ReferredResourceExtractor.cs


示例15: EpmContentDeSerializer

 /// <summary>
 /// Constructor creates contained serializers
 /// </summary>
 /// <param name="resourceType">Resource type being serialized</param>
 /// <param name="element">Instance of <paramref name="resourceType"/></param>
 internal EpmContentDeSerializer(ResourceType resourceType, object element)
 {
     Debug.Assert(resourceType.HasEntityPropertyMappings == true, "Must have entity property mappings to instantiate EpmContentDeSerializer");
     this.resourceType = resourceType;
     this.element = element;
     this.resourceType.EnsureEpmInfoAvailability();
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:12,代码来源:EpmContentDeSerializer.cs


示例16: GetEntityAssociationLinks

 private IEnumerable<ODataAssociationLink> GetEntityAssociationLinks(ResourceType currentResourceType, Uri relativeUri, IEnumerable<ProjectionNode> projectionNodesForCurrentResourceType)
 {
     if (!base.Service.Configuration.DataServiceBehavior.ShouldIncludeAssociationLinksInResponse)
     {
         return null;
     }
     List<ODataAssociationLink> list = new List<ODataAssociationLink>(currentResourceType.Properties.Count);
     if (projectionNodesForCurrentResourceType == null)
     {
         foreach (ResourceProperty property in base.Provider.GetResourceSerializableProperties(base.CurrentContainer, currentResourceType))
         {
             if (property.TypeKind == ResourceTypeKind.EntityType)
             {
                 list.Add(GetAssociationLink(relativeUri, property));
             }
         }
         return list;
     }
     foreach (ProjectionNode node in projectionNodesForCurrentResourceType)
     {
         string propertyName = node.PropertyName;
         ResourceProperty navigationProperty = node.TargetResourceType.TryResolvePropertyName(propertyName);
         if (((navigationProperty != null) && (navigationProperty.TypeKind == ResourceTypeKind.EntityType)) && (list != null))
         {
             list.Add(GetAssociationLink(relativeUri, navigationProperty));
         }
     }
     return list;
 }
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:EntitySerializer.cs


示例17: GetActionTitleSegmentByResourceType

 internal string GetActionTitleSegmentByResourceType(ResourceType resourceType, string containerName)
 {
     string str;
     if (!this.actionTitleSegmentByResourceType.TryGetValue(resourceType, out str))
     {
         bool flag = false;
         if (resourceType.IsOpenType)
         {
             flag = true;
         }
         else
         {
             foreach (ResourceProperty property in resourceType.Properties)
             {
                 if (property.Name.Equals(this.Name, StringComparison.Ordinal))
                 {
                     flag = true;
                     break;
                 }
             }
         }
         str = flag ? (containerName + "." + this.Name) : this.Name;
         this.actionTitleSegmentByResourceType[resourceType] = str;
     }
     return str;
 }
开发者ID:nickchal,项目名称:pash,代码行数:26,代码来源:OperationWrapper.cs


示例18: CreateResourceWithKeyAndReferenceSetCmdlets

		public static DSResource CreateResourceWithKeyAndReferenceSetCmdlets(ResourceType resourceType, Dictionary<string, object> keyProperties, EntityMetadata entityMetadata)
		{
			DSResource dSResource = ResourceTypeExtensions.CreateKeyOnlyResource(resourceType, keyProperties);
			if (dSResource != null)
			{
				PSEntityMetadata pSEntityMetadatum = entityMetadata as PSEntityMetadata;
				ReadOnlyCollection<ResourceProperty> properties = resourceType.Properties;
				foreach (ResourceProperty resourceProperty in properties.Where<ResourceProperty>((ResourceProperty it) => (it.Kind & ResourcePropertyKind.ResourceSetReference) == ResourcePropertyKind.ResourceSetReference))
				{
					PSEntityMetadata.ReferenceSetCmdlets referenceSetCmdlet = null;
					if (!pSEntityMetadatum.CmdletsForReferenceSets.TryGetValue(resourceProperty.Name, out referenceSetCmdlet) || !referenceSetCmdlet.Cmdlets.ContainsKey(CommandType.GetReference))
					{
						continue;
					}
					if (referenceSetCmdlet.GetRefHidden)
					{
						dSResource.SetValue(resourceProperty.Name, null);
					}
					else
					{
						PSReferencedResourceSet pSReferencedResourceSet = new PSReferencedResourceSet(resourceProperty, resourceType);
						dSResource.SetValue(resourceProperty.Name, pSReferencedResourceSet);
					}
				}
				return dSResource;
			}
			else
			{
				return null;
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:31,代码来源:ResourceTypeExtensions.cs


示例19: WritePrimitiveValue

        /// <summary>
        /// Converts the given value to the ATOM string representation
        /// and uses the writer to write it.
        /// </summary>
        /// <param name="writer">The writer to write the stringified value.</param>
        /// <param name="value">The value to be written.</param>
        /// <param name="expectedType">The expected resource type of the value or null if no metadata is available.</param>
        internal static void WritePrimitiveValue(XmlWriter writer, object value, ResourceType expectedType)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(value != null, "value != null");
            
            string result;
            bool preserveWhitespace;
            if (!TryConvertPrimitiveToString(value, out result, out preserveWhitespace))
            {
                throw new ODataException(Strings.AtomValueUtils_CannotConvertValueToAtomPrimitive(value.GetType().FullName));
            }

            if (expectedType != null)
            {
                ValidationUtils.ValidateIsExpectedPrimitiveType(value, expectedType);
            }

            if (preserveWhitespace)
            {
                writer.WriteAttributeString(
                    AtomConstants.XmlNamespacePrefix,
                    AtomConstants.XmlSpaceAttributeName,
                    AtomConstants.XmlNamespace,
                    AtomConstants.XmlPreserveSpaceAttributeValue);
            }

            writer.WriteString(result);
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:35,代码来源:AtomValueUtils.cs


示例20: ReferenceTypeSerializer

		public ReferenceTypeSerializer(ResourceType referringResourceType, ResourceProperty resourceProperty) : base(resourceProperty.ResourceType)
		{
			if (resourceProperty.ResourceType.ResourceTypeKind == ResourceTypeKind.EntityType)
			{
				object[] name = new object[1];
				name[0] = resourceProperty.Name;
				referringResourceType.ThrowIfNull("referringResourceType", new ParameterExtensions.MessageLoader(SerializerBase.GetReferringResourceTypeCannotNullMessage), name);
				DataContext currentContext = DataServiceController.Current.GetCurrentContext();
				if (currentContext != null)
				{
					PSEntityMetadata entityMetadata = currentContext.UserSchema.GetEntityMetadata(referringResourceType) as PSEntityMetadata;
					PSEntityMetadata.ReferenceSetCmdlets referenceSetCmdlet = null;
					if (!entityMetadata.CmdletsForReferenceSets.TryGetValue(resourceProperty.Name, out referenceSetCmdlet))
					{
						this.referencePropertyType = PSEntityMetadata.ReferenceSetCmdlets.ReferencePropertyType.Instance;
					}
					else
					{
						this.referencePropertyType = referenceSetCmdlet.PropertyType;
						return;
					}
				}
				return;
			}
			else
			{
				throw new ArgumentException("resourceType");
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:ReferenceTypeSerializer.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Spatial.DbGeography类代码示例发布时间:2022-05-26
下一篇:
C# Providers.ResourceProperty类代码示例发布时间: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