• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Types.EntityTypeConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration的典型用法代码示例。如果您正苦于以下问题:C# EntityTypeConfiguration类的具体用法?C# EntityTypeConfiguration怎么用?C# EntityTypeConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntityTypeConfiguration类属于System.Data.Entity.ModelConfiguration.Configuration.Types命名空间,在下文中一共展示了EntityTypeConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EntityTypeConfiguration

        private EntityTypeConfiguration(EntityTypeConfiguration source)
            : base(source)
        {
            DebugCheck.NotNull(source);

            _keyProperties.AddRange(source._keyProperties);
            source._navigationPropertyConfigurations.Each(
                c => _navigationPropertyConfigurations.Add(c.Key, c.Value.Clone()));
            source._entitySubTypesMappingConfigurations.Each(
                c => _entitySubTypesMappingConfigurations.Add(c.Key, c.Value.Clone()));

            _entityMappingConfigurations.AddRange(
                source._entityMappingConfigurations.Except(source._nonCloneableMappings).Select(e => e.Clone()));

            _isKeyConfigured = source._isKeyConfigured;
            _entitySetName = source._entitySetName;

            if (source._modificationFunctionsConfiguration != null)
            {
                _modificationFunctionsConfiguration = source._modificationFunctionsConfiguration.Clone();
            }

            IsReplaceable = source.IsReplaceable;
            IsTableNameConfigured = source.IsTableNameConfigured;
            IsExplicitEntity = source.IsExplicitEntity;
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:26,代码来源:EntityTypeConfiguration.cs


示例2: Map_TDerived_should_add_mapping_configuration_to_self_if_tderived_is_same_as_tentity

        public void Map_TDerived_should_add_mapping_configuration_to_self_if_tderived_is_same_as_tentity()
        {
            var entityConfiguration = new EntityTypeConfiguration<A>();
            entityConfiguration.Map<A>(m => m.ToTable("A"));

            Assert.Equal("A", ((EntityTypeConfiguration)entityConfiguration.Configuration).GetTableName().Name);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:EntityTypeConfigurationTests.cs


示例3: Configure_should_configure_modification_functions

        public void Configure_should_configure_modification_functions()
        {
            var model = new EdmModel(DataSpace.CSpace);

            var entityType = model.AddEntityType("E");
            entityType.GetMetadataProperties().SetClrType(typeof(object));

            model.AddEntitySet("ESet", entityType);

            var modificationFunctionsConfigurationMock = new Mock<ModificationStoredProceduresConfiguration>();

            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));
            entityTypeConfiguration.MapToStoredProcedures(modificationFunctionsConfigurationMock.Object, true);

            entityType.SetConfiguration(entityTypeConfiguration);

            var databaseMapping
                = new DatabaseMappingGenerator(ProviderRegistry.Sql2008_ProviderInfo, ProviderRegistry.Sql2008_ProviderManifest).Generate(model);

            entityTypeConfiguration.Configure(entityType, databaseMapping, ProviderRegistry.Sql2008_ProviderManifest);

            modificationFunctionsConfigurationMock
                .Verify(
                    m => m.Configure(
                        It.IsAny<EntityTypeModificationFunctionMapping>(), It.IsAny<DbProviderManifest>()),
                    Times.Once());
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:27,代码来源:EntityTypeConfigurationTests.cs


示例4: Configuration_should_return_internal_configuration

        public void Configuration_should_return_internal_configuration()
        {
            var entityConfiguration = new EntityTypeConfiguration<object>();

            Assert.NotNull(entityConfiguration.Configuration);
            Assert.Equal(typeof(EntityTypeConfiguration), entityConfiguration.Configuration.GetType());
        }
开发者ID:,项目名称:,代码行数:7,代码来源:


示例5: Add

        internal virtual void Add(EntityTypeConfiguration entityTypeConfiguration)
        {
            DebugCheck.NotNull(entityTypeConfiguration);

            EntityTypeConfiguration existingConfiguration;

            if ((_entityConfigurations.TryGetValue(entityTypeConfiguration.ClrType, out existingConfiguration)
                 && !existingConfiguration.IsReplaceable)
                || _complexTypeConfigurations.ContainsKey(entityTypeConfiguration.ClrType))
            {
                throw Error.DuplicateStructuralTypeConfiguration(entityTypeConfiguration.ClrType);
            }

            if (existingConfiguration != null
                && existingConfiguration.IsReplaceable)
            {
                _entityConfigurations.Remove(existingConfiguration.ClrType);
                entityTypeConfiguration.ReplaceFrom(existingConfiguration);
            }
            else
            {
                entityTypeConfiguration.IsReplaceable = false;
            }

            _entityConfigurations.Add(entityTypeConfiguration.ClrType, entityTypeConfiguration);
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:26,代码来源:ModelConfiguration.cs


示例6: Configure

 internal override void Configure(
     EdmAssociationType associationType, EdmAssociationEnd dependentEnd,
     EntityTypeConfiguration entityTypeConfiguration)
 {
     //Contract.Requires(associationType != null);
     //Contract.Requires(dependentEnd != null);
     //Contract.Requires(entityTypeConfiguration != null);
 }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:8,代码来源:ConstraintConfiguration.cs


示例7: HasKey_should_throw_when_invalid_key_expression

        public void HasKey_should_throw_when_invalid_key_expression()
        {
            var entityConfiguration = new EntityTypeConfiguration<object>();

            Assert.Equal(
                Strings.InvalidPropertiesExpression("o => o.ToString()"),
                Assert.Throws<InvalidOperationException>(() => entityConfiguration.HasKey(o => o.ToString())).Message);
        }
开发者ID:,项目名称:,代码行数:8,代码来源:


示例8: Apply_should_set_table_name

        public void Apply_should_set_table_name()
        {
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            new TableAttributeConvention.TableAttributeConventionImpl()
                .Apply(new MockType(), entityTypeConfiguration, new TableAttribute("Foo"));

            Assert.Equal("Foo", entityTypeConfiguration.GetTableName().Name);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:9,代码来源:TableAttributeConventionTests.cs


示例9: MapToStoredProcedures_should_call_method_on_internal_configuration

        public void MapToStoredProcedures_should_call_method_on_internal_configuration()
        {
            var mockEntityTypeConfiguration = new Mock<EntityTypeConfiguration>(typeof(Fixture));
            var entityConfiguration = new EntityTypeConfiguration<Fixture>(mockEntityTypeConfiguration.Object);

            entityConfiguration.MapToStoredProcedures();

            mockEntityTypeConfiguration.Verify(e => e.MapToStoredProcedures());
        }
开发者ID:,项目名称:,代码行数:9,代码来源:


示例10: Configure_should_set_configuration

        public void Configure_should_set_configuration()
        {
            var entityType = new EntityType("E", "N", DataSpace.CSpace);
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            entityTypeConfiguration.Configure(entityType, new EdmModel(DataSpace.CSpace));

            Assert.Same(entityTypeConfiguration, entityType.GetConfiguration());
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:9,代码来源:EntityTypeConfigurationTests.cs


示例11: HasKey_should_add_key_properties

        public void HasKey_should_add_key_properties()
        {
            var mockEntityTypeConfiguration = new Mock<EntityTypeConfiguration>(typeof(Fixture));
            var entityConfiguration = new EntityTypeConfiguration<Fixture>(mockEntityTypeConfiguration.Object);

            entityConfiguration.HasKey(f => f.Id);

            mockEntityTypeConfiguration.Verify(e => e.Key(new[] { typeof(Fixture).GetProperty("Id") }));
        }
开发者ID:,项目名称:,代码行数:9,代码来源:


示例12: Map_TDerived_should_throw_for_repeat_configuration_of_derived_type

 public void Map_TDerived_should_throw_for_repeat_configuration_of_derived_type()
 {
     var entityConfiguration = new EntityTypeConfiguration<A>();
     Assert.Equal(Strings.InvalidChainedMappingSyntax("B"), Assert.Throws<InvalidOperationException>(() => entityConfiguration
                                                                                                                     .Map<A>(m => m.ToTable("A"))
                                                                                                                     .Map<B>(mb => mb.ToTable("B"))
                                                                                                                     .Map<C>(mc => mc.ToTable("C"))
                                                                                                                     .Map<B>(mb2 => mb2.ToTable("B"))).Message);
 }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:9,代码来源:EntityTypeConfigurationTests.cs


示例13: Can_pass_function_mapping_configuration_to_map_to_functions

        public void Can_pass_function_mapping_configuration_to_map_to_functions()
        {
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            Assert.Null(entityTypeConfiguration.ModificationStoredProceduresConfiguration);

            entityTypeConfiguration.MapToStoredProcedures(new ModificationStoredProceduresConfiguration(), true);

            Assert.NotNull(entityTypeConfiguration.ModificationStoredProceduresConfiguration);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:10,代码来源:EntityTypeConfigurationTests.cs


示例14: Configure

        internal override void Configure(
            AssociationType associationType, AssociationEndMember dependentEnd,
            EntityTypeConfiguration entityTypeConfiguration)
        {
            DebugCheck.NotNull(associationType);
            DebugCheck.NotNull(dependentEnd);
            DebugCheck.NotNull(entityTypeConfiguration);

            associationType.MarkIndependent();
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:10,代码来源:IndependentConstraintConfiguration.cs


示例15: Apply_should_ignore_property

        public void Apply_should_ignore_property()
        {
            var mockPropertyInfo = new MockPropertyInfo();
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            new NotMappedPropertyAttributeConvention.NotMappedPropertyAttributeConventionImpl()
                .Apply(mockPropertyInfo, entityTypeConfiguration, new NotMappedAttribute());

            Assert.True(entityTypeConfiguration.IgnoredProperties.Contains(mockPropertyInfo));
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:10,代码来源:NotMappedAttributeConventionTests.cs


示例16: Can_pass_function_mapping_configuration_to_map_to_functions

        public void Can_pass_function_mapping_configuration_to_map_to_functions()
        {
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            Assert.False(entityTypeConfiguration.IsMappedToFunctions);

            entityTypeConfiguration.MapToStoredProcedures(new ModificationFunctionsConfiguration());

            Assert.True(entityTypeConfiguration.IsMappedToFunctions);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:10,代码来源:EntityTypeConfigurationTests.cs


示例17: MapToStoredProcedures_should_create_empty_function_mapping_configuration

        public void MapToStoredProcedures_should_create_empty_function_mapping_configuration()
        {
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            Assert.False(entityTypeConfiguration.IsMappedToFunctions);

            entityTypeConfiguration.MapToStoredProcedures();

            Assert.True(entityTypeConfiguration.IsMappedToFunctions);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:10,代码来源:EntityTypeConfigurationTests.cs


示例18: MapToStoredProcedures_should_create_empty_function_mapping_configuration

        public void MapToStoredProcedures_should_create_empty_function_mapping_configuration()
        {
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));

            Assert.Null(entityTypeConfiguration.ModificationStoredProceduresConfiguration);

            entityTypeConfiguration.MapToStoredProcedures();

            Assert.NotNull(entityTypeConfiguration.ModificationStoredProceduresConfiguration);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:10,代码来源:EntityTypeConfigurationTests.cs


示例19: Apply_should_not_set_table_name_when_already_set

        public void Apply_should_not_set_table_name_when_already_set()
        {
            var entityTypeConfiguration = new EntityTypeConfiguration(typeof(object));
            entityTypeConfiguration.ToTable("Bar");

            new TableAttributeConvention()
                .Apply(new MockType(), entityTypeConfiguration, new TableAttribute("Foo"));

            Assert.Equal("Bar", entityTypeConfiguration.GetTableName().Name);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:10,代码来源:TableAttributeConventionTests.cs


示例20: Property_evaluates_preconditions

        public void Property_evaluates_preconditions()
        {
            var type = typeof(LocalEntityType);
            var innerConfig = new EntityTypeConfiguration(type);
            var config = new LightweightEntityConfiguration<object>(type, () => innerConfig);

            var ex = Assert.Throws<ArgumentNullException>(
                () => config.Property<object>(null));

            Assert.Equal("propertyExpression", ex.ParamName);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:11,代码来源:LightweightEntityConfigurationOfTTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Spatial.DbGeography类代码示例发布时间:2022-05-26
下一篇:
C# Navigation.NavigationPropertyConfiguration类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap