当前位置: 首页>>代码示例>>C#>>正文


C# ResourceType.ThrowIfNull方法代码示例

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


在下文中一共展示了ResourceType.ThrowIfNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: AddDerivedType

		public static void AddDerivedType(this ResourceType resourceType, ResourceType derivedType)
		{
			object[] name = new object[1];
			name[0] = resourceType.Name;
			derivedType.ThrowIfNull("derivedType", Resources.NullPassedAsDerivedType, name);
			object[] fullName = new object[2];
			fullName[0] = resourceType.FullName;
			fullName[1] = derivedType.FullName;
			ExceptionHelpers.ThrowArgumentExceptionIf("derivedType", derivedType.BaseType != resourceType, Resources.NotBaseResourceType, fullName);
			(resourceType.CustomState as ResourceCustomState).DerivedTypes.Add(derivedType);
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:ResourceTypeExtensions.cs

示例3: ReferenceSetSerializer

		public ReferenceSetSerializer(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);
				this.resourceProperty = resourceProperty;
				this.referringResourceType = referringResourceType;
				return;
			}
			else
			{
				throw new ArgumentException("resourceType");
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:16,代码来源:ReferenceSetSerializer.cs

示例4: AddResourceSet

		internal ResourceSet AddResourceSet(string name, ResourceType entityType)
		{
			name.ThrowIfNullOrEmpty("name", Resources.NullIsPassedAsResourceSetName, new object[0]);
			object[] objArray = new object[1];
			objArray[0] = name;
			entityType.ThrowIfNull("entityType", Resources.ParameterSetNull, objArray);
			if (entityType.ResourceTypeKind == ResourceTypeKind.EntityType)
			{
				ResourceSet resourceSet = new ResourceSet(name, entityType);
				if (!this.ResourceSets.Keys.Contains<string>(name))
				{
					this.ResourceSets.Add(name, resourceSet);
					return resourceSet;
				}
				else
				{
					object[] item = new object[3];
					item[0] = name;
					item[1] = entityType.Name;
					item[2] = this.ResourceSets[name];
					throw new ArgumentException(ExceptionHelpers.GetExceptionMessage(Resources.ResourceSetNameDuplicated, item));
				}
			}
			else
			{
				throw new InvalidResourceTypeException(entityType.Name, entityType.ResourceTypeKind.ToString(), ResourceTypeKind.EntityType.ToString());
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:28,代码来源:Schema.cs


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