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


C# ClassMap类代码示例

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


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

示例1: ShouldHaveSameTableNameForBothSidesOfMappingWhenRightSpecified

        public void ShouldHaveSameTableNameForBothSidesOfMappingWhenRightSpecified()
        {
            var model = new PersistenceModel();
            var leftMap = new ClassMap<Left>();

            leftMap.Id(x => x.Id);
            leftMap.HasManyToMany(x => x.Rights);

            var rightMap = new ClassMap<Right>();

            rightMap.Id(x => x.Id);
            rightMap.HasManyToMany(x => x.Lefts)
                .Table("MyJoinTable");

            model.Add(leftMap);
            model.Add(rightMap);

            var mappings = model.BuildMappings();

            var leftMapping = mappings.SelectMany(x => x.Classes).Where(x => x.Type == typeof(Left)).First();
            var rightMapping = mappings.SelectMany(x => x.Classes).Where(x => x.Type == typeof(Right)).First();

            leftMapping.Collections.First().TableName.ShouldEqual("MyJoinTable");
            rightMapping.Collections.First().TableName.ShouldEqual("MyJoinTable");
        }
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:25,代码来源:ManyToManyTableNameTests.cs

示例2: CanCreateClassMap

        public void CanCreateClassMap()
        {
            var classMap = new ClassMap<Artist>();
            ClassMapping mapping = classMap.GetClassMapping();

            mapping.Type.ShouldEqual(typeof(Artist));
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:7,代码来源:ClassMapTester.cs

示例3: SetUp

 public void SetUp()
 {
     tourMap = new ClassMap<Tour>(Version.LUCENE_30);
     tourMap.Property(p => p.AccommodationAges).Stored().NotAnalyzed();
     tourMap.Property(p => p.TotalPriceMin).Stored().NotAnalyzed();
     tourMap.Property(p => p.TotalPriceMax).Stored().NotAnalyzed();
 }
开发者ID:Zaixu,项目名称:Lucene.Net.Linq,代码行数:7,代码来源:EnumerableContainsTests.cs

示例4: ShouldAllowConventionsToAlterBiDirectionalTableNames

        public void ShouldAllowConventionsToAlterBiDirectionalTableNames()
        {
            var model = new PersistenceModel();
            var leftMap = new ClassMap<Left>();

            leftMap.Id(x => x.Id);
            leftMap.HasManyToMany(x => x.Rights);

            var rightMap = new ClassMap<Right>();

            rightMap.Id(x => x.Id);
            rightMap.HasManyToMany(x => x.Lefts);

            model.Add(leftMap);
            model.Add(rightMap);
            model.Conventions.Add<TestTableNameConvention>();

            var mappings = model.BuildMappings();

            var leftMapping = mappings.SelectMany(x => x.Classes).Where(x => x.Type == typeof(Left)).First();
            var rightMapping = mappings.SelectMany(x => x.Classes).Where(x => x.Type == typeof(Right)).First();

            leftMapping.Collections.First().TableName.ShouldEqual("Lefts_Rights");
            rightMapping.Collections.First().TableName.ShouldEqual("Lefts_Rights");
        }
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:25,代码来源:ManyToManyTableNameTests.cs

示例5: GenerateIdsFor

        public void GenerateIdsFor(object entity, ClassMap classMap)
        {
            this.currentClassMap = classMap;
            this.currentEntity = entity;

            this.Visit(classMap);
        }
开发者ID:andoco,项目名称:mongodb-csharp,代码行数:7,代码来源:IdGenerator.cs

示例6: Mapping

        private void Mapping(Action<KeyManyToOnePart> mappingDefinition)
        {
            var classMap = new ClassMap<ExampleClass>();
            var map = classMap.CompositeId()
                .KeyProperty(x => x.Id)
                .KeyReference(x => x.Parent, mappingDefinition);

            mapping = classMap;
        }
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:9,代码来源:KeyManyToOneConventionTests.cs

示例7: CanMapProperty

        public void CanMapProperty()
        {
            var classMap = new ClassMap<Artist>();
            classMap.Map(x => x.Name);
            ClassMapping mapping = classMap.GetClassMapping();

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

示例8: CanMapCollection

        public void CanMapCollection()
        {
            var classMap = new ClassMap<Artist>();
            classMap.HasMany<Album>(x => x.Albums);
            ClassMapping mapping = classMap.GetClassMapping();

            var collection = mapping.Collections.FirstOrDefault() as BagMapping;
            collection.ShouldNotBeNull();
            collection.MappedMember.ShouldEqual(ReflectionHelper.GetMember<Artist>(x => x.Albums));
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:10,代码来源:ClassMapTester.cs

示例9: CanMapReference

        public void CanMapReference()
        {
            var classMap = new ClassMap<Album>();
            classMap.References(x => x.Artist);
            ClassMapping mapping = classMap.GetClassMapping();

            var reference = mapping.References.FirstOrDefault();
            reference.ShouldNotBeNull();
            reference.MappedMember.ShouldEqual(ReflectionHelper.GetMember<Album>(x => x.Artist));
        }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:10,代码来源:ClassMapTester.cs

示例10: NeverShouldSetDefaultLazyToFalse

 public void NeverShouldSetDefaultLazyToFalse()
 {
     var classMap = new ClassMap<Target>();
     classMap.Id(x => x.Id);
     model.Add(classMap);
     model.Conventions.Add(DefaultLazy.Never());
     model.BuildMappings()
         .First()
         .DefaultLazy.ShouldBeFalse();
 }
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:10,代码来源:DefaultLazyHelperTests.cs

示例11: ShouldSetDefaultAccessToValue

 public void ShouldSetDefaultAccessToValue()
 {
     var classMap = new ClassMap<Target>();
     classMap.Id(x => x.Id);
     model.Add(classMap);
     model.Conventions.Add(AutoImport.Never());
     model.BuildMappings()
         .First()
         .AutoImport.ShouldEqual(false);
 }
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:10,代码来源:AutoImportHelperTests.cs

示例12: AlwaysShouldSetDefaultLazyToTrue

 public void AlwaysShouldSetDefaultLazyToTrue()
 {
     var classMap = new ClassMap<Target>();
     classMap.Id(x => x.Id);
     model.Add(classMap);
     model.Conventions.Add(DefaultLazy.Always());
     model.BuildMappings()
         .First()
         .DefaultLazy.ShouldBeTrue();
 }
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:10,代码来源:DefaultLazyHelperTests.cs

示例13: ShouldSetDefaultAccessToValue

 public void ShouldSetDefaultAccessToValue()
 {
     var classMap = new ClassMap<Target>();
     classMap.Id(x => x.Id);
     model.Add(classMap);
     model.Conventions.Add(DefaultAccess.Field());
     model.BuildMappings()
         .First()
         .DefaultAccess.ShouldEqual("field");
 }
开发者ID:garrisonx,项目名称:NH3BegginnersGuide,代码行数:10,代码来源:DefaultAccessHelperTests.cs

示例14: establish_context

        public override void establish_context()
        {
            inline_component = new ClassMap<Target>();
            inline_component.Component(x => x.ComponentProperty, c => c.Map(x => x.Property));

            external_component = new ComponentMap<Component>();
            external_component.Map(x => x.Property);

            reference_component = new ClassMap<Target>();
            reference_component.Component(x => x.ComponentProperty);
        }
开发者ID:JamesKovacs,项目名称:fluent-nhibernate,代码行数:11,代码来源:ExternalComponentOutputSpecs.cs

示例15: CreateDocument

        public Document CreateDocument(ClassMap classMap, object entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");
            this.entity = entity;

            this.document = new Document();
            classMap.Accept(this);

            return this.document;
        }
开发者ID:andoco,项目名称:mongodb-csharp,代码行数:11,代码来源:DeleteDocumentMapper.cs


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