本文整理汇总了C#中IEdmTypeReference.AsEntityReference方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmTypeReference.AsEntityReference方法的具体用法?C# IEdmTypeReference.AsEntityReference怎么用?C# IEdmTypeReference.AsEntityReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmTypeReference
的用法示例。
在下文中一共展示了IEdmTypeReference.AsEntityReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToTaupoDataType
private DataType ConvertToTaupoDataType(IEdmTypeReference edmTypeReference)
{
EdmTypeKind kind = edmTypeReference.TypeKind();
if (kind == EdmTypeKind.Collection)
{
var elementEdmTypeReference = edmTypeReference.AsCollection().ElementType();
return DataTypes.CollectionType
.WithElementDataType(this.ConvertToTaupoDataType(elementEdmTypeReference))
.Nullable(edmTypeReference.IsNullable);
}
else if (kind == EdmTypeKind.Complex)
{
var complexEdmTypeDefinition = edmTypeReference.AsComplex().ComplexDefinition();
return DataTypes.ComplexType
.WithName(complexEdmTypeDefinition.Namespace, complexEdmTypeDefinition.Name)
.Nullable(edmTypeReference.IsNullable);
}
else if (kind == EdmTypeKind.Entity)
{
var entityEdmTypeDefinition = edmTypeReference.AsEntity().EntityDefinition();
return DataTypes.EntityType
.WithName(entityEdmTypeDefinition.Namespace, entityEdmTypeDefinition.Name)
.Nullable(edmTypeReference.IsNullable);
}
else if (kind == EdmTypeKind.EntityReference)
{
var entityEdmTypeDefinition = edmTypeReference.AsEntityReference().EntityType();
return DataTypes.ReferenceType
.WithEntityType(new EntityTypeReference(entityEdmTypeDefinition.Namespace, entityEdmTypeDefinition.Name))
.Nullable(edmTypeReference.IsNullable);
}
else if (kind == EdmTypeKind.Primitive)
{
return EdmToTaupoPrimitiveDataTypeConverter.ConvertToTaupoPrimitiveDataType(edmTypeReference.AsPrimitive());
}
else if (kind == EdmTypeKind.Enum)
{
var enumTypeDefinition = edmTypeReference.AsEnum().EnumDefinition();
return DataTypes.EnumType.WithName(enumTypeDefinition.Namespace, enumTypeDefinition.Name);
}
throw new TaupoInvalidOperationException("unexpected Edm Type Kind: " + kind);
}
示例2: CreateEntityReference
private IEdmTypeReference CreateEntityReference(IEdmTypeReference edmTypeReference, EdmModel stockModel)
{
var edmEntityReferenceTypeReference = edmTypeReference.AsEntityReference();
var stockEntityReference = new EdmEntityReferenceType((IEdmEntityType)stockModel.FindType(edmEntityReferenceTypeReference.EntityType().FullName()));
return new EdmEntityReferenceTypeReference(stockEntityReference, edmEntityReferenceTypeReference.IsNullable);
}