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

C# SubclassMapping类代码示例

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

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



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

示例1: ShouldWriteJoinedSubclassForJoinedSubclassMapping

        public void ShouldWriteJoinedSubclassForJoinedSubclassMapping()
        {
            var mapping = new SubclassMapping(SubclassType.JoinedSubclass);

            writer.VerifyXml(mapping)
                .RootElement.HasName("joined-subclass");
        }
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:7,代码来源:XmlInheritanceWriterTester.cs


示例2: ShouldWriteSubclassForSubclassMapping

        public void ShouldWriteSubclassForSubclassMapping()
        {
            var mapping = new SubclassMapping();

            writer.VerifyXml(mapping)
                .RootElement.HasName("subclass");
        }
开发者ID:sbakshi,项目名称:fluent-nhibernate,代码行数:7,代码来源:XmlInheritanceWriterTester.cs


示例3: MapInheritanceTree

        private void MapInheritanceTree(Type classType, ClassMappingBase mapping, IList<Member> mappedMembers)
        {
            var discriminatorSet = HasDiscriminator(mapping);
            var isDiscriminated = cfg.IsDiscriminated(classType) || discriminatorSet;
            var mappingTypesWithLogicalParents = GetMappingTypesWithLogicalParents();

            foreach (var inheritedClass in mappingTypesWithLogicalParents
                .Where(x => x.Value != null && x.Value.Type == classType)
                .Select(x => x.Key))
            {
                var tempMapping = mapping as ClassMapping;
                var tempIsNull = tempMapping == null;
                if (isDiscriminated && !discriminatorSet && !tempIsNull)
                {
                    var discriminatorColumn = cfg.GetDiscriminatorColumn(classType);
                    var discriminator = new DiscriminatorMapping
                    {
                        ContainingEntityType = classType,
                        Type = new TypeReference(typeof(string))
                    };
                    discriminator.AddDefaultColumn(new ColumnMapping { Name = discriminatorColumn });

                    tempMapping.Discriminator = discriminator;
                    discriminatorSet = true;
                }

                SubclassMapping subclassMapping;

                if(!tempIsNull && tempMapping.IsUnionSubclass)
                {
                    subclassMapping = new SubclassMapping(SubclassType.UnionSubclass)
                    {
                        Type = inheritedClass.Type
                    };
                }
                else if(!isDiscriminated)
                {
                    subclassMapping = new SubclassMapping(SubclassType.JoinedSubclass)
                    {
                        Type = inheritedClass.Type
                    };
                    subclassMapping.Key = new KeyMapping();
                    subclassMapping.Key.AddDefaultColumn(new ColumnMapping { Name = mapping.Type.Name + "_id" });
                }
                else
                    subclassMapping = new SubclassMapping(SubclassType.Subclass)
                    {
                        Type = inheritedClass.Type
                    };

				// track separate set of properties for each sub-tree within inheritance hierarchy
            	var subclassMembers = new List<Member>(mappedMembers);
				MapSubclass(subclassMembers, subclassMapping, inheritedClass);

                mapping.AddSubclass(subclassMapping);

				MergeMap(inheritedClass.Type, subclassMapping, subclassMembers);
            }
        }
开发者ID:henriksen,项目名称:fluent-nhibernate,代码行数:59,代码来源:AutoMapper.cs


示例4: ShouldWriteBag

        public void ShouldWriteBag()
        {
            var mapping = new SubclassMapping();

            mapping.AddCollection(new BagMapping());

            writer.VerifyXml(mapping)
                .Element("bag").Exists();
        }
开发者ID:JasonTrue,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlSubclassWriterTester.cs


示例5: ProcessSubclass

        public override void ProcessSubclass(SubclassMapping mapping)
        {
            var subclasses = FindClosestSubclasses(mapping.Type);

            foreach (var provider in subclasses)
                mapping.AddSubclass(provider.GetSubclassMapping(new SubclassMapping()));

            base.ProcessSubclass(mapping);
        }
开发者ID:JonKruger,项目名称:fluent-nhibernate,代码行数:9,代码来源:SeparateSubclassVisitor.cs


示例6: ShouldWriteAny

        public void ShouldWriteAny()
        {
            var mapping = new SubclassMapping();

            mapping.AddAny(new AnyMapping());

            writer.VerifyXml(mapping)
                .Element("any").Exists();
        }
开发者ID:JasonTrue,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlSubclassWriterTester.cs


示例7: ShouldWriteComponents

        public void ShouldWriteComponents()
        {
            var mapping = new SubclassMapping();

            mapping.AddComponent(new ComponentMapping());

            writer.VerifyXml(mapping)
                .Element("component").Exists();
        }
开发者ID:JasonTrue,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlSubclassWriterTester.cs


示例8: ProcessSubclass

        public override void ProcessSubclass(SubclassMapping mapping)
        {
            var subclasses = subclassProviders
                .Select(x => x.GetSubclassMapping(new SubclassMapping()))
                .Where(x => x.Type.BaseType == mapping.Type);

            foreach (var subclass in subclasses)
                mapping.AddSubclass(subclass);

            base.ProcessSubclass(mapping);
        }
开发者ID:sbakshi,项目名称:fluent-nhibernate,代码行数:11,代码来源:SeparateSubclassVisitor.cs


示例9: Should_write_the_components

        public void Should_write_the_components()
        {
            var classMapping = new SubclassMapping();
            classMapping.AddComponent(new ComponentMapping());

            _mocker.Get<IHbmWriter<ComponentMapping>>()
                .Expect(x => x.Write(classMapping.Components.First())).Return(new HbmComponent());

            _subclassWriter.VerifyXml(classMapping)
                .Element("component").Exists();
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:11,代码来源:HbmSubclassWriterTester.cs


示例10: Should_write_multiple_nestings_of_subclasses

        public void Should_write_multiple_nestings_of_subclasses()
        {
            var subclassMapping = new SubclassMapping();

            subclassMapping.AddSubclass(new SubclassMapping { Name = "Child" });
            subclassMapping.Subclasses.First().AddSubclass(new SubclassMapping { Name = "Grandchild" });

            _subclassWriter.VerifyXml(subclassMapping)
                .Element("subclass").Exists().HasAttribute("name", "Child")
                .Element("subclass").Exists().HasAttribute("name", "Grandchild");
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:11,代码来源:HbmSubclassWriterTester.cs


示例11: Can_map_property

        public void Can_map_property()
        {
            var mapping = new SubclassMapping();
            var subclassPart = new SubclassPart<SalaryEmployee>(mapping);

            subclassPart.Map(x => x.Salary);

            var salaryProperty = mapping.Properties.FirstOrDefault();
            salaryProperty.ShouldNotBeNull();
            salaryProperty.MappedMember.ShouldEqual(ReflectionHelper.GetMember<SalaryEmployee>(x => x.Salary));
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:11,代码来源:SubclassPartTester.cs


示例12: Should_write_the_collections

        public void Should_write_the_collections()
        {
            var subclassMapping = new SubclassMapping();
            subclassMapping.AddCollection(new BagMapping());

            _mocker.Get<IHbmWriter<ICollectionMapping>>()
                .Expect(x => x.Write(subclassMapping.Collections.First())).Return(new HbmBag());

            _subclassWriter.VerifyXml(subclassMapping)
                .Element("bag").Exists();
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:11,代码来源:HbmSubclassWriterTester.cs


示例13: MapInheritanceTree

        private void MapInheritanceTree(Type classType, ClassMappingBase mapping, IList<Member> mappedMembers)
        {
            var discriminatorSet = false;
            var isDiscriminated = cfg.IsDiscriminated(classType);

            foreach (var inheritedClass in mappingTypes.Where(q =>
                q.Type.BaseType == classType &&
                    !cfg.IsConcreteBaseType(q.Type.BaseType)))
            {
                if (isDiscriminated && !discriminatorSet && mapping is ClassMapping)
                {
                    var discriminatorColumn = cfg.GetDiscriminatorColumn(classType);
                    var discriminator = new DiscriminatorMapping
                    {
                        ContainingEntityType = classType,
                        Type = new TypeReference(typeof(string))
                    };
                    discriminator.AddDefaultColumn(new ColumnMapping { Name = discriminatorColumn });

                    ((ClassMapping)mapping).Discriminator = discriminator;
                    discriminatorSet = true;
                }

                SubclassMapping subclassMapping;
                var subclassStrategy = cfg.GetSubclassStrategy(classType);

                if (subclassStrategy == SubclassStrategy.JoinedSubclass)
                {
                    subclassMapping = new SubclassMapping(SubclassType.JoinedSubclass);
                    subclassMapping.Key = new KeyMapping();
                    subclassMapping.Key.AddDefaultColumn(new ColumnMapping { Name = mapping.Type.Name + "_id" });
                }
                else
                    subclassMapping = new SubclassMapping(SubclassType.Subclass);

				// track separate set of properties for each sub-tree within inheritance hierarchy
            	var subclassMembers = new List<Member>(mappedMembers);
				MapSubclass(subclassMembers, subclassMapping, inheritedClass);

                mapping.AddSubclass(subclassMapping);

				MergeMap(inheritedClass.Type, subclassMapping, subclassMembers);
            }
        }
开发者ID:erikojebo,项目名称:fluent-nhibernate,代码行数:44,代码来源:AutoMapper.cs


示例14: ShouldWriteProperties

        public void ShouldWriteProperties()
        {
            var mapping = new SubclassMapping(SubclassType.JoinedSubclass);

            mapping.AddProperty(new PropertyMapping());

            writer.VerifyXml(mapping)
                .Element("property").Exists();
        }
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlJoinedSubclassWriterTester.cs


示例15: SubclassInspector

 public SubclassInspector(SubclassMapping mapping)
 {
     this.mapping = mapping;
     mappedProperties.Map(x => x.LazyLoad, x => x.Lazy);
 }
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:5,代码来源:SubclassInspector.cs


示例16: MapSubclass

 private void MapSubclass(IList<Member> mappedMembers, SubclassMapping subclass, AutoMapType inheritedClass)
 {
     subclass.Name = inheritedClass.Type.AssemblyQualifiedName;
     subclass.Type = inheritedClass.Type;
     ApplyOverrides(inheritedClass.Type, mappedMembers, subclass);
     ProcessClass(subclass, inheritedClass.Type, mappedMembers);
     inheritedClass.IsMapped = true;
 }
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:8,代码来源:AutoMapper.cs


示例17: MapInheritanceTree

        private void MapInheritanceTree(Type classType, ClassMappingBase mapping, IList<string> mappedProperties)
        {
            var discriminatorSet = false;
            var isDiscriminated = expressions.IsDiscriminated(classType);

            foreach (var inheritedClass in mappingTypes.Where(q =>
                q.Type.BaseType == classType &&
                    !expressions.IsConcreteBaseType(q.Type.BaseType)))
            {
                if (isDiscriminated && !discriminatorSet && mapping is ClassMapping)
                {
                    var discriminatorColumn = expressions.DiscriminatorColumn(classType);
                    var discriminator = new DiscriminatorMapping
                    {
                        ContainingEntityType = classType,
                        Type = new TypeReference(typeof(string))
                    };
                    discriminator.AddDefaultColumn(new ColumnMapping { Name = discriminatorColumn });

                    ((ClassMapping)mapping).Discriminator = discriminator;
                    discriminatorSet = true;
                }

                ISubclassMapping subclassMapping;
                var subclassStrategy = expressions.SubclassStrategy(classType);

                if (subclassStrategy == SubclassStrategy.JoinedSubclass)
                {
                    // TODO: This id name should be removed. Ideally it needs to be set by a
                    // default and be overridable by a convention (preferably the ForeignKey convention
                    // that already exists)
                    var subclass = new JoinedSubclassMapping
                    {
                        Type = inheritedClass.Type
                    };

                    subclass.Key = new KeyMapping();
                    subclass.Key.AddDefaultColumn(new ColumnMapping { Name = mapping.Type.Name + "_id" });

                    subclassMapping = subclass;
                }
                else
                    subclassMapping = new SubclassMapping();

                MapSubclass(mappedProperties, subclassMapping, inheritedClass);

                mapping.AddSubclass(subclassMapping);

                MergeMap(inheritedClass.Type, (ClassMappingBase)subclassMapping, mappedProperties);
            }
        }
开发者ID:Kaidanov,项目名称:fluent-nhibernate,代码行数:51,代码来源:AutoMapper.cs


示例18: Visit

 public virtual void Visit(SubclassMapping subclassMapping)
 {
 }
开发者ID:playtime,项目名称:fluent-nhibernate,代码行数:3,代码来源:NullMappingModelVisitor.cs


示例19: ShouldWriteSubclass

        public void ShouldWriteSubclass()
        {
            var mapping = new SubclassMapping(SubclassType.JoinedSubclass);

            mapping.AddSubclass(new SubclassMapping(SubclassType.JoinedSubclass));

            writer.VerifyXml(mapping)
                .Element("joined-subclass").Exists();
        }
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlJoinedSubclassWriterTester.cs


示例20: ShouldWriteDynamicComponents

        public void ShouldWriteDynamicComponents()
        {
            var mapping = new SubclassMapping(SubclassType.JoinedSubclass);

            mapping.AddComponent(new ComponentMapping(ComponentType.DynamicComponent));

            writer.VerifyXml(mapping)
                .Element("dynamic-component").Exists();
        }
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:9,代码来源:XmlJoinedSubclassWriterTester.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Subject类代码示例发布时间:2022-05-24
下一篇:
C# DB.mobilesitedesignerDB类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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