本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.ComplexType.GetMetadataProperties方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexType.GetMetadataProperties方法的具体用法?C# ComplexType.GetMetadataProperties怎么用?C# ComplexType.GetMetadataProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Entity.Core.Metadata.Edm.ComplexType
的用法示例。
在下文中一共展示了ComplexType.GetMetadataProperties方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClrType_returns_CLR_type_annotation_for_ComplexType
public void GetClrType_returns_CLR_type_annotation_for_ComplexType()
{
var complexType = new ComplexType("C", "N", DataSpace.CSpace);
Assert.Null(((EdmType)complexType).GetClrType());
complexType.GetMetadataProperties().SetClrType(typeof(Random));
Assert.Same(typeof(Random), ((EdmType)complexType).GetClrType());
}
示例2: Should_be_able_to_get_and_set_clr_type
public void Should_be_able_to_get_and_set_clr_type()
{
var complexType = new ComplexType("C");
Assert.Null(complexType.GetClrType());
var type = typeof(object);
complexType.GetMetadataProperties().SetClrType(type);
Assert.Equal(typeof(object), complexType.GetClrType());
}
示例3: GetComplexParameterBindings_should_return_all_complex_parameter_bindings_for_type
public void GetComplexParameterBindings_should_return_all_complex_parameter_bindings_for_type()
{
var databaseMapping
= new DbDatabaseMapping()
.Initialize(
new EdmModel(DataSpace.CSpace),
new EdmModel(DataSpace.SSpace));
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = databaseMapping.Model.AddEntitySet("ES", entityType);
var entitySetMapping = databaseMapping.AddEntitySetMapping(entitySet);
var complexType1 = new ComplexType();
complexType1.GetMetadataProperties().SetClrType(typeof(string));
var complexType2 = new ComplexType();
complexType2.GetMetadataProperties().SetClrType(typeof(object));
var storageModificationFunctionMapping
= new ModificationFunctionMapping(
entitySet,
entityType,
new EdmFunction("F", "N", DataSpace.SSpace),
new[]
{
new ModificationFunctionParameterBinding(
new FunctionParameter(),
new ModificationFunctionMemberPath(
new EdmMember[]
{
EdmProperty.CreateComplex("C1", complexType1),
EdmProperty.CreateComplex("C2", complexType2),
new EdmProperty("M")
},
null),
true
)
},
null,
null);
entitySetMapping.AddModificationFunctionMapping(
new EntityTypeModificationFunctionMapping(
entityType,
storageModificationFunctionMapping,
storageModificationFunctionMapping,
storageModificationFunctionMapping));
Assert.Equal(3, databaseMapping.GetComplexParameterBindings(typeof(string)).Count());
Assert.Equal(3, databaseMapping.GetComplexParameterBindings(typeof(object)).Count());
}
示例4: GetComplexPropertyMappings_should_return_all_complex_property_mappings_for_type
public void GetComplexPropertyMappings_should_return_all_complex_property_mappings_for_type()
{
var databaseMapping = new DbDatabaseMapping()
.Initialize(new EdmModel(DataSpace.CSpace), new EdmModel(DataSpace.SSpace));
var entitySet = new EntitySet
{
Name = "ES"
};
var entitySetMapping = databaseMapping.AddEntitySetMapping(entitySet);
var entityTypeMapping = new EntityTypeMapping(null);
entitySetMapping.AddTypeMapping(entityTypeMapping);
var entityTypeMappingFragment = new MappingFragment(entitySet, entityTypeMapping, false);
entityTypeMapping.AddFragment(entityTypeMappingFragment);
var complexType = new ComplexType("C");
var propertyMapping1
= new ColumnMappingBuilder(
new EdmProperty("C", TypeUsage.Create(new PrimitiveType() { DataSpace = DataSpace.SSpace })),
new[]
{
EdmProperty.CreateComplex("P1", complexType),
EdmProperty.CreatePrimitive("P", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String))
});
var type = typeof(object);
complexType.GetMetadataProperties().SetClrType(type);
entityTypeMappingFragment.AddColumnMapping(propertyMapping1);
var propertyMapping2
= new ColumnMappingBuilder(
new EdmProperty("C", TypeUsage.Create(new PrimitiveType() { DataSpace = DataSpace.SSpace })),
new List<EdmProperty>
{
EdmProperty.CreateComplex("P3", complexType),
EdmProperty.CreatePrimitive(
"P2", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)),
});
entityTypeMappingFragment.AddColumnMapping(propertyMapping2);
Assert.Equal(2, databaseMapping.GetComplexPropertyMappings(typeof(object)).Count());
}
示例5: Configure
internal virtual void Configure(ComplexType complexType)
{
Configure(complexType.Name, complexType.Properties, complexType.GetMetadataProperties());
}