本文整理汇总了C#中TypeMapper.MapComplexType方法的典型用法代码示例。如果您正苦于以下问题:C# TypeMapper.MapComplexType方法的具体用法?C# TypeMapper.MapComplexType怎么用?C# TypeMapper.MapComplexType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeMapper
的用法示例。
在下文中一共展示了TypeMapper.MapComplexType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapComplexType_should_not_map_ignored_type
public void MapComplexType_should_not_map_ignored_type()
{
var model = new EdmModel(DataSpace.CSpace);
var mockModelConfiguration = new Mock<ModelConfiguration>();
var typeMapper = new TypeMapper(new MappingContext(mockModelConfiguration.Object, new ConventionsConfiguration(), model));
mockModelConfiguration.Setup(m => m.IsIgnoredType(typeof(AType1))).Returns(true);
var complexType = typeMapper.MapComplexType(typeof(AType1));
Assert.Null(complexType);
}
示例2: MapComplexType_should_recognize_StoreIgnore_over_StoreInline
public void MapComplexType_should_recognize_StoreIgnore_over_StoreInline()
{
var type = typeof(TypeMapper_EntityWithStoreInlineAndStoreIgnore);
var model = new EdmModel(DataSpace.CSpace);
var modelConfiguration = new ModelConfiguration();
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
typeMapper.MapComplexType(type);
Assert.True(modelConfiguration.IsIgnoredType(type));
Assert.Equal(0, model.EntityTypes.Count());
Assert.Equal(0, model.ComplexTypes.Count());
}
示例3: MapComplexType_should_set_namespace_when_provided_via_model_configuration
public void MapComplexType_should_set_namespace_when_provided_via_model_configuration()
{
var model = new EdmModel(DataSpace.CSpace);
var mockType = new MockType("Foo");
var modelConfiguration = new ModelConfiguration
{
ModelNamespace = "Bar"
};
modelConfiguration.ComplexType(mockType);
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
var complexType = typeMapper.MapComplexType(mockType);
Assert.NotNull(complexType);
Assert.Equal("Bar", complexType.NamespaceName);
}
示例4: MapComplexType_should_create_complex_type_with_clr_type_name_and_add_to_model
public void MapComplexType_should_create_complex_type_with_clr_type_name_and_add_to_model()
{
var model = new EdmModel(DataSpace.CSpace);
var mockType = new MockType("Foo");
var modelConfiguration = new ModelConfiguration();
modelConfiguration.ComplexType(mockType);
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
var complexType = typeMapper.MapComplexType(mockType);
Assert.NotNull(complexType);
Assert.Same(complexType, model.GetComplexType("Foo"));
}
示例5: MapEnumType_should_should_throw_for_new_type_if_complex_type_with_same_simple_name_already_used
public void MapEnumType_should_should_throw_for_new_type_if_complex_type_with_same_simple_name_already_used()
{
var model = new EdmModel(DataSpace.CSpace);
var mockType1 = new MockType("Foo");
var mockType2 = new MockType("Foo");
var modelConfiguration = new ModelConfiguration();
modelConfiguration.ComplexType(mockType1);
mockType2.SetupGet(t => t.IsEnum).Returns(true);
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
Assert.NotNull(typeMapper.MapComplexType(mockType1));
Assert.Equal(
Strings.SimpleNameCollision("Foo", "Foo", "Foo"),
Assert.Throws<NotSupportedException>(() => typeMapper.MapEnumType(mockType2)).Message);
}
示例6: MapComplexType_should_recognize_StoreInline
public void MapComplexType_should_recognize_StoreInline()
{
var type = typeof(TypeMapper_EntityWithStoreInline);
var model = new EdmModel().Initialize();
var modelConfiguration = new ModelConfiguration();
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
typeMapper.MapComplexType(type);
Assert.True(modelConfiguration.IsComplexType(type));
Assert.Equal(0, model.Namespaces.Single().EntityTypes.Count);
Assert.Equal(1, model.Namespaces.Single().ComplexTypes.Count);
}
示例7: MapComplexType_should_ignore_new_type_if_type_name_already_used
public void MapComplexType_should_ignore_new_type_if_type_name_already_used()
{
var model = new EdmModel().Initialize();
var mockType1 = new MockType("Foo");
var mockType2 = new MockType("Foo");
var modelConfiguration = new ModelConfiguration();
modelConfiguration.ComplexType(mockType1);
modelConfiguration.ComplexType(mockType2);
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
Assert.NotNull(typeMapper.MapComplexType(mockType1));
Assert.Null(typeMapper.MapComplexType(mockType2));
}
示例8: MapEnumType_should_should_throw_for_new_type_if_complex_type_with_same_simple_name_already_used
public void MapEnumType_should_should_throw_for_new_type_if_complex_type_with_same_simple_name_already_used()
{
var model = new EdmModel(DataSpace.CSpace);
var modelConfiguration = new ModelConfiguration();
modelConfiguration.ComplexType(typeof(Outer5.AType5));
var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model));
Assert.NotNull(typeMapper.MapComplexType(typeof(Outer5.AType5)));
Assert.Equal(
Strings.SimpleNameCollision(typeof(AType5).FullName, typeof(Outer5.AType5).FullName, "AType5"),
Assert.Throws<NotSupportedException>(() => typeMapper.MapEnumType(typeof(AType5))).Message);
}
示例9: MapComplexType_should_not_map_invalid_structural_type
public void MapComplexType_should_not_map_invalid_structural_type()
{
var model = new EdmModel(DataSpace.CSpace);
var typeMapper = new TypeMapper(new MappingContext(new ModelConfiguration(), new ConventionsConfiguration(), model));
Assert.Null(typeMapper.MapComplexType(typeof(string)));
}