本文整理汇总了C#中Microsoft.Test.Taupo.Contracts.EntityModel.EntityModelSchema.EntityContainer方法的典型用法代码示例。如果您正苦于以下问题:C# EntityModelSchema.EntityContainer方法的具体用法?C# EntityModelSchema.EntityContainer怎么用?C# EntityModelSchema.EntityContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Test.Taupo.Contracts.EntityModel.EntityModelSchema
的用法示例。
在下文中一共展示了EntityModelSchema.EntityContainer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildEdmValueModel
/// <summary>
/// Creates a test model to test our conversion of OData instances into EDM values.
/// </summary>
/// <returns>Returns a model suitable for testing EDM values over OData instances.</returns>
public static EntityModelSchema BuildEdmValueModel()
{
EntityModelSchema model = new EntityModelSchema();
var complexType = model.ComplexType("ComplexType");
complexType.Property("IntProp", EdmDataTypes.Int32);
complexType.Property("StringProp", EdmDataTypes.String());
complexType.Property("ComplexProp", complexType);
#region Entity types
model.EntityContainer("TestContainer");
// Entity type with a single primitive property
var singlePrimitivePropertyEntityType = model.EntityType("SinglePrimitivePropertyEntityType");
singlePrimitivePropertyEntityType.KeyProperty("ID", EdmDataTypes.Int32);
singlePrimitivePropertyEntityType.Property("Int32Prop", EdmDataTypes.Int32.Nullable());
model.EntitySet("SinglePrimitivePropertyEntityType", singlePrimitivePropertyEntityType);
// Entity type with all primitive properties
var allPrimitivePropertiesEntityType = model.EntityType("AllPrimitivePropertiesEntityType");
allPrimitivePropertiesEntityType.KeyProperty("ID", EdmDataTypes.Int32);
allPrimitivePropertiesEntityType.Property("BoolProp", EdmDataTypes.Boolean);
allPrimitivePropertiesEntityType.Property("Int16Prop", EdmDataTypes.Int16);
allPrimitivePropertiesEntityType.Property("Int32Prop", EdmDataTypes.Int32);
allPrimitivePropertiesEntityType.Property("Int64Prop", EdmDataTypes.Int64);
allPrimitivePropertiesEntityType.Property("ByteProp", EdmDataTypes.Byte);
allPrimitivePropertiesEntityType.Property("SByteProp", EdmDataTypes.SByte);
allPrimitivePropertiesEntityType.Property("SingleProp", EdmDataTypes.Single);
allPrimitivePropertiesEntityType.Property("DoubleProp", EdmDataTypes.Double);
allPrimitivePropertiesEntityType.Property("DecimalProp", EdmDataTypes.Decimal());
allPrimitivePropertiesEntityType.Property("DateTimeOffsetProp", EdmDataTypes.DateTimeOffset());
allPrimitivePropertiesEntityType.Property("DurationProp", EdmDataTypes.Time());
allPrimitivePropertiesEntityType.Property("GuidProp", EdmDataTypes.Guid);
allPrimitivePropertiesEntityType.Property("StringProp", EdmDataTypes.String());
allPrimitivePropertiesEntityType.Property("BinaryProp", EdmDataTypes.Binary());
model.EntitySet("AllPrimitivePropertiesEntityType", allPrimitivePropertiesEntityType);
// Entity type with a single complex property
var singleComplexPropertyEntityType = model.EntityType("SingleComplexPropertyEntityType");
singleComplexPropertyEntityType.KeyProperty("ID", EdmDataTypes.Int32);
singleComplexPropertyEntityType.Property("ComplexProp", complexType);
model.EntitySet("SingleComplexPropertyEntityType", singleComplexPropertyEntityType);
// Entity type with a single primitive collection property
var singlePrimitiveCollectionPropertyEntityType = model.EntityType("SinglePrimitiveCollectionPropertyEntityType");
singlePrimitiveCollectionPropertyEntityType.KeyProperty("ID", EdmDataTypes.Int32);
singlePrimitiveCollectionPropertyEntityType.Property("PrimitiveCollectionProp", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Int32));
model.EntitySet("SinglePrimitiveCollectionPropertyEntityType", singlePrimitiveCollectionPropertyEntityType);
// Entity type with a single primitive collection property
var singleComplexCollectionPropertyEntityType = model.EntityType("SingleComplexCollectionPropertyEntityType");
singleComplexCollectionPropertyEntityType.KeyProperty("ID", EdmDataTypes.Int32);
singleComplexCollectionPropertyEntityType.Property("ComplexCollectionProp", DataTypes.CollectionOfComplex(complexType));
model.EntitySet("SingleComplexCollectionPropertyEntityType", singleComplexCollectionPropertyEntityType);
// Entity type with different property kinds
var differentPropertyKindsEntityType = model.EntityType("DifferentPropertyKindsEntityType");
differentPropertyKindsEntityType.KeyProperty("ID", EdmDataTypes.Int32);
differentPropertyKindsEntityType.Property("ComplexProp", complexType);
differentPropertyKindsEntityType.Property("PrimitiveCollectionProp", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Int32));
differentPropertyKindsEntityType.Property("Int32Prop", EdmDataTypes.Int32);
differentPropertyKindsEntityType.Property("ComplexCollectionProp", DataTypes.CollectionOfComplex(complexType));
model.EntitySet("DifferentPropertyKindsEntityType", differentPropertyKindsEntityType);
#endregion Entity types
#region Complex types
// Empty complex type
var emptyComplexType = model.ComplexType("EmptyComplexType");
// Complex type with a single primitive property
var singlePrimitivePropertyComplexType = model.ComplexType("SinglePrimitivePropertyComplexType");
singlePrimitivePropertyComplexType.Property("Int32Prop", EdmDataTypes.Int32.Nullable());
// Complex type with all primitive properties
var allPrimitivePropertiesComplexType = model.ComplexType("AllPrimitivePropertiesComplexType");
allPrimitivePropertiesComplexType.Property("BoolProp", EdmDataTypes.Boolean);
allPrimitivePropertiesComplexType.Property("Int16Prop", EdmDataTypes.Int16);
allPrimitivePropertiesComplexType.Property("Int32Prop", EdmDataTypes.Int32);
allPrimitivePropertiesComplexType.Property("Int64Prop", EdmDataTypes.Int64);
allPrimitivePropertiesComplexType.Property("ByteProp", EdmDataTypes.Byte);
allPrimitivePropertiesComplexType.Property("SByteProp", EdmDataTypes.SByte);
allPrimitivePropertiesComplexType.Property("SingleProp", EdmDataTypes.Single);
allPrimitivePropertiesComplexType.Property("DoubleProp", EdmDataTypes.Double);
allPrimitivePropertiesComplexType.Property("DecimalProp", EdmDataTypes.Decimal());
allPrimitivePropertiesComplexType.Property("DateTimeOffsetProp", EdmDataTypes.DateTimeOffset());
allPrimitivePropertiesComplexType.Property("DurationProp", EdmDataTypes.Time());
allPrimitivePropertiesComplexType.Property("GuidProp", EdmDataTypes.Guid);
allPrimitivePropertiesComplexType.Property("StringProp", EdmDataTypes.String());
allPrimitivePropertiesComplexType.Property("BinaryProp", EdmDataTypes.Binary());
// Complex type with a single complex property
var singleComplexPropertyComplexType = model.ComplexType("SingleComplexPropertyComplexType");
singleComplexPropertyComplexType.Property("ComplexProp", complexType);
// Complex type with a single primitive collection property
var singlePrimitiveCollectionPropertyComplexType = model.ComplexType("SinglePrimitiveCollectionPropertyComplexType");
singlePrimitiveCollectionPropertyComplexType.Property("PrimitiveCollectionProp", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Int32));
//.........这里部分代码省略.........