当前位置: 首页>>代码示例>>C#>>正文


C# EdmModel.GetEntitySet方法代码示例

本文整理汇总了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);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:14,代码来源:TypeMapperTests.cs

示例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);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:11,代码来源:EdmModelExtensionsTests.cs

示例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);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:19,代码来源:EntityTypeConfiguration.cs

示例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);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:14,代码来源:TypeMapperTests.cs


注:本文中的System.Data.Entity.Edm.EdmModel.GetEntitySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。