本文整理汇总了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");
}
}
示例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);
}
示例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");
}
}
示例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());
}
}