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

C# Navigation.NavigationPropertyConfiguration类代码示例

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

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



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

示例1: CascadableNavigationPropertyConfiguration

        internal CascadableNavigationPropertyConfiguration(
            NavigationPropertyConfiguration navigationPropertyConfiguration)
        {
            Contract.Requires(navigationPropertyConfiguration != null);

            _navigationPropertyConfiguration = navigationPropertyConfiguration;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:CascadableNavigationPropertyConfiguration.cs


示例2: NavigationPropertyConfiguration

        private NavigationPropertyConfiguration(NavigationPropertyConfiguration source)
        {
            DebugCheck.NotNull(source);

            _navigationProperty = source._navigationProperty;
            _endKind = source._endKind;
            _inverseNavigationProperty = source._inverseNavigationProperty;
            _inverseEndKind = source._inverseEndKind;

            _constraint = source._constraint == null
                              ? null
                              : source._constraint.Clone();

            _associationMappingConfiguration
                = source._associationMappingConfiguration == null
                      ? null
                      : source._associationMappingConfiguration.Clone();

            DeleteAction = source.DeleteAction;
            IsNavigationPropertyDeclaringTypePrincipal = source.IsNavigationPropertyDeclaringTypePrincipal;

            _modificationFunctionsConfiguration
                = source._modificationFunctionsConfiguration == null
                      ? null
                      : source._modificationFunctionsConfiguration.Clone();
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:26,代码来源:NavigationPropertyConfiguration.cs


示例3: Configure_should_configure_inverse

        public void Configure_should_configure_inverse()
        {
            var inverseMockPropertyInfo = new MockPropertyInfo();
            var navigationPropertyConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo())
                                                      {
                                                          InverseNavigationProperty = inverseMockPropertyInfo
                                                      };
            var associationType = new EdmAssociationType().Initialize();
            var inverseAssociationType = new EdmAssociationType().Initialize();
            var model = new EdmModel().Initialize();
            model.AddAssociationType(inverseAssociationType);
            var inverseNavigationProperty
                = model.AddEntityType("T")
                    .AddNavigationProperty("N", inverseAssociationType);
            inverseNavigationProperty.SetClrPropertyInfo(inverseMockPropertyInfo);

            navigationPropertyConfiguration.Configure(
                new EdmNavigationProperty
                    {
                        Association = associationType
                    }, model, new EntityTypeConfiguration(typeof(object)));

            Assert.Same(associationType, inverseNavigationProperty.Association);
            Assert.Same(associationType.SourceEnd, inverseNavigationProperty.ResultEnd);
            Assert.Equal(0, model.GetAssociationTypes().Count());
        }
开发者ID:junxy,项目名称:entityframework,代码行数:26,代码来源:NavigationPropertyConfigurationTests.cs


示例4: Configure_should_configure_inverse

        public void Configure_should_configure_inverse()
        {
            var inverseMockPropertyInfo = new MockPropertyInfo();
            var navigationPropertyConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo())
                                                      {
                                                          InverseNavigationProperty = inverseMockPropertyInfo
                                                      };
            var associationType = new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace);
            associationType.SourceEnd = new AssociationEndMember("S", new EntityType("E", "N", DataSpace.CSpace));
            associationType.TargetEnd = new AssociationEndMember("T", new EntityType("E", "N", DataSpace.CSpace));
            var inverseAssociationType = new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace);
            inverseAssociationType.SourceEnd = new AssociationEndMember("S", new EntityType("E", "N", DataSpace.CSpace));
            inverseAssociationType.TargetEnd = new AssociationEndMember("T", new EntityType("E", "N", DataSpace.CSpace));
            var model = new EdmModel(DataSpace.CSpace);
            model.AddAssociationType(inverseAssociationType);
            var inverseNavigationProperty
                = model.AddEntityType("T")
                       .AddNavigationProperty("N", inverseAssociationType);
            inverseNavigationProperty.SetClrPropertyInfo(inverseMockPropertyInfo);

            navigationPropertyConfiguration.Configure(
                new NavigationProperty("N", TypeUsage.Create(associationType.TargetEnd.GetEntityType()))
                    {
                        RelationshipType = associationType
                    }, model, new EntityTypeConfiguration(typeof(object)));

            Assert.Same(associationType, inverseNavigationProperty.Association);
            Assert.Same(associationType.SourceEnd, inverseNavigationProperty.ResultEnd);
            Assert.Same(associationType.TargetEnd, inverseNavigationProperty.FromEndMember);
            Assert.Equal(0, model.AssociationTypes.Count());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:31,代码来源:NavigationPropertyConfigurationTests.cs


示例5: CascadableNavigationPropertyConfiguration

        protected CascadableNavigationPropertyConfiguration(
            NavigationPropertyConfiguration navigationPropertyConfiguration)
        {
            Check.NotNull(navigationPropertyConfiguration, "navigationPropertyConfiguration");

            _navigationPropertyConfiguration = navigationPropertyConfiguration;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:CascadableNavigationPropertyConfiguration.cs


示例6: Inverse_navigation_property_should_throw_when_self_inverse

        public void Inverse_navigation_property_should_throw_when_self_inverse()
        {
            var mockPropertyInfo = new MockPropertyInfo();
            var navigationPropertyConfiguration = new NavigationPropertyConfiguration(mockPropertyInfo);

            Assert.Equal(Strings.NavigationInverseItself("P", typeof(object)), Assert.Throws<InvalidOperationException>(() => navigationPropertyConfiguration.InverseNavigationProperty = mockPropertyInfo).Message);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:NavigationPropertyConfigurationTests.cs


示例7: ManyToManyNavigationPropertyConfiguration

        internal ManyToManyNavigationPropertyConfiguration(
            NavigationPropertyConfiguration navigationPropertyConfiguration)
        {
            Contract.Requires(navigationPropertyConfiguration != null);

            _navigationPropertyConfiguration = navigationPropertyConfiguration;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:ManyToManyNavigationPropertyConfiguration.cs


示例8: CascadableNavigationPropertyConfiguration

        // <summary>Initializes a new instance of the <see cref="T:System.Data.Entity.ModelConfiguration.Configuration.CascadableNavigationPropertyConfiguration" /> class.</summary>
        internal CascadableNavigationPropertyConfiguration(
            NavigationPropertyConfiguration navigationPropertyConfiguration)
        {
            DebugCheck.NotNull(navigationPropertyConfiguration);

            _navigationPropertyConfiguration = navigationPropertyConfiguration;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:CascadableNavigationPropertyConfiguration.cs


示例9: Has_foreign_key_should_throw_when_invalid_key_expression

        public void Has_foreign_key_should_throw_when_invalid_key_expression()
        {
            var navigationPropertyConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            Assert.Equal(Strings.InvalidPropertiesExpression("d => d.ToString()"), Assert.Throws<InvalidOperationException>(() => new DependentNavigationPropertyConfiguration<D>(navigationPropertyConfiguration)
                                                                                                                                            .HasForeignKey(d => d.ToString())).Message);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:DependentNavigationPropertyConfigurationTests.cs


示例10: ManyToManyNavigationPropertyConfiguration

        internal ManyToManyNavigationPropertyConfiguration(
            NavigationPropertyConfiguration navigationPropertyConfiguration)
        {
            DebugCheck.NotNull(navigationPropertyConfiguration);

            _navigationPropertyConfiguration = navigationPropertyConfiguration;
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:7,代码来源:ManyToManyNavigationPropertyConfiguration.cs


示例11: With_required_should_set_inverse_when_specified

        public void With_required_should_set_inverse_when_specified()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new ManyNavigationPropertyConfiguration<S, T>(associationConfiguration).WithRequired(t => t.S);

            Assert.Equal("S", associationConfiguration.InverseNavigationProperty.Name);
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:8,代码来源:ManyNavigationPropertyConfigurationTests.cs


示例12: With_many_should_set_target_end_kind_to_many

        public void With_many_should_set_target_end_kind_to_many()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new ManyNavigationPropertyConfiguration<S, T>(associationConfiguration).WithMany();

            Assert.Equal(EdmAssociationEndKind.Many, associationConfiguration.InverseEndKind);
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:8,代码来源:ManyNavigationPropertyConfigurationTests.cs


示例13: With_optional_dependent_should_set_target_end_kind_to_optional

        public void With_optional_dependent_should_set_target_end_kind_to_optional()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N"));

            new OptionalNavigationPropertyConfiguration<S, T>(associationConfiguration).WithOptionalDependent();

            Assert.Equal(RelationshipMultiplicity.ZeroOrOne, associationConfiguration.InverseEndKind);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:OptionalNavigationPropertyConfigurationTests.cs


示例14: Will_cascade_should_set_correct_delete_action

        public void Will_cascade_should_set_correct_delete_action()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new ForeignKeyNavigationPropertyConfiguration(associationConfiguration).WillCascadeOnDelete();

            Assert.Equal(EdmOperationAction.Cascade, associationConfiguration.DeleteAction);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:8,代码来源:CascadableNavigationPropertyConfigurationTests.cs


示例15: With_optional_principal_should_set_inverse_when_specified

        public void With_optional_principal_should_set_inverse_when_specified()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new OptionalNavigationPropertyConfiguration<S, T>(associationConfiguration).WithOptionalPrincipal(t => t.S);

            Assert.Equal("S", associationConfiguration.InverseNavigationProperty.Name);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:8,代码来源:OptionalNavigationPropertyConfigurationTests.cs


示例16: Ctor_should_set_source_end_kind_to_optional

        public void Ctor_should_set_source_end_kind_to_optional()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new OptionalNavigationPropertyConfiguration<S, T>(associationConfiguration);

            Assert.Equal(EdmAssociationEndKind.Optional, associationConfiguration.EndKind);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:8,代码来源:OptionalNavigationPropertyConfigurationTests.cs


示例17: Ctor_should_set_source_end_kind_to_optional

        public void Ctor_should_set_source_end_kind_to_optional()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new OptionalNavigationPropertyConfiguration<S, T>(associationConfiguration);

            Assert.Equal(RelationshipMultiplicity.ZeroOrOne, associationConfiguration.RelationshipMultiplicity);
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:8,代码来源:OptionalNavigationPropertyConfigurationTests.cs


示例18: Will_cascade_false_should_set_correct_delete_action

        public void Will_cascade_false_should_set_correct_delete_action()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N"));

            new ForeignKeyNavigationPropertyConfiguration(associationConfiguration).WillCascadeOnDelete(false);

            Assert.Equal(OperationAction.None, associationConfiguration.DeleteAction);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:CascadableNavigationPropertyConfigurationTests.cs


示例19: With_many_should_set_target_end_kind_to_many

        public void With_many_should_set_target_end_kind_to_many()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo());

            new OptionalNavigationPropertyConfiguration<S, T>(associationConfiguration).WithMany();

            Assert.Equal(RelationshipMultiplicity.Many, associationConfiguration.InverseEndKind);
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:8,代码来源:OptionalNavigationPropertyConfigurationTests.cs


示例20: Ctor_should_set_source_end_kind_to_required

        public void Ctor_should_set_source_end_kind_to_required()
        {
            var associationConfiguration = new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N"));

            new RequiredNavigationPropertyConfiguration<S, T>(associationConfiguration);

            Assert.Equal(RelationshipMultiplicity.One, associationConfiguration.RelationshipMultiplicity);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:RequiredNavigationPropertyConfigurationTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Types.EntityTypeConfiguration类代码示例发布时间:2022-05-26
下一篇:
C# Configuration.ModelConfiguration类代码示例发布时间: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