本文整理汇总了C#中System.Data.Entity.Edm.EdmModel.GetEntitySet方法的典型用法代码示例。如果您正苦于以下问题:C# EdmModel.GetEntitySet方法的具体用法?C# EdmModel.GetEntitySet怎么用?C# EdmModel.GetEntitySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Entity.Edm.EdmModel
的用法示例。
在下文中一共展示了EdmModel.GetEntitySet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapEntityType_should_not_bring_in_base_class_by_default
public void MapEntityType_should_not_bring_in_base_class_by_default()
{
var model = new EdmModel().Initialize();
var typeMapper = new TypeMapper(new MappingContext(new ModelConfiguration(), new ConventionsConfiguration(), model));
var mockType = new MockType("Bar").BaseType(new MockType("Foo"));
var entityType = typeMapper.MapEntityType(mockType);
Assert.NotNull(entityType);
Assert.Null(entityType.BaseType);
Assert.Equal(1, model.Namespaces.Single().EntityTypes.Count);
Assert.Equal(1, model.Containers.Single().EntitySets.Count);
Assert.Equal("Bar", model.GetEntitySet(entityType).Name);
}
示例2: GetEntitySet_should_return_entity_set
public void GetEntitySet_should_return_entity_set()
{
var model = new EdmModel().Initialize();
var entityType = model.AddEntityType("Foo");
model.AddEntitySet("FooSet", entityType);
var entitySet = model.GetEntitySet(entityType);
Assert.NotNull(entitySet);
Assert.Same(entityType, entitySet.ElementType);
}
示例3: ConfigureEntitySetName
private void ConfigureEntitySetName(EdmEntityType entityType, EdmModel model)
{
Contract.Requires(entityType != null);
Contract.Requires(model != null);
if ((EntitySetName == null)
|| (entityType.BaseType != null))
{
return;
}
var entitySet = model.GetEntitySet(entityType);
Contract.Assert(entitySet != null);
entitySet.Name = model.GetEntitySets().Except(new[] { entitySet }).UniquifyName(EntitySetName);
entitySet.SetConfiguration(this);
}
示例4: MapEntityType_should_create_entity_set_and_add_to_model
public void MapEntityType_should_create_entity_set_and_add_to_model()
{
var model = new EdmModel().Initialize();
var typeMapper = new TypeMapper(new MappingContext(new ModelConfiguration(), new ConventionsConfiguration(), model));
var mockType = new MockType("Foo");
var entityType = typeMapper.MapEntityType(mockType);
var entitySet = model.GetEntitySet(entityType);
Assert.NotNull(entitySet);
Assert.Same(entityType, entitySet.ElementType);
Assert.Equal("Foo", entitySet.Name);
}