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


C# ObjectRelationalMapper.TablePerConcreteClass方法代码示例

本文整理汇总了C#中ObjectRelationalMapper.TablePerConcreteClass方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectRelationalMapper.TablePerConcreteClass方法的具体用法?C# ObjectRelationalMapper.TablePerConcreteClass怎么用?C# ObjectRelationalMapper.TablePerConcreteClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectRelationalMapper的用法示例。


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

示例1: RegisteringComponentAndEntityThrow

 public void RegisteringComponentAndEntityThrow()
 {
     var mapper = new ObjectRelationalMapper();
     mapper.Component<AComponent>();
     ActionAssert.Throws(() => mapper.TablePerClass<AComponent>()).Should().Be.InstanceOf<MappingException>();
     ActionAssert.Throws(() => mapper.TablePerConcreteClass<AComponent>()).Should().Be.InstanceOf<MappingException>();
     ActionAssert.Throws(() => mapper.TablePerClassHierarchy<AComponent>()).Should().Be.InstanceOf<MappingException>();
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:8,代码来源:ComponentRegistrationTest.cs

示例2: IntegrationWithObjectRelationalMapper

        public void IntegrationWithObjectRelationalMapper()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerConcreteClass<AbstractEntity>();
            HbmMapping mapping = GetMapping(orm);
            VerifyEntitySimpleMapping(mapping);

            HbmClass rc = mapping.RootClasses.Single();
            rc.Id.generator.Should("The ORM should assign a default generator").Not.Be.Null();

            VerifyHinheritedMapping(mapping);
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:12,代码来源:HierarchyTablePerConcreteClassTest.cs

示例3: WhenExplicitExcludedThenNotTablePerConcreteClass

        public void WhenExplicitExcludedThenNotTablePerConcreteClass()
        {
            // To prevent inconsistence
            var orm = new ObjectRelationalMapper();
            orm.TablePerConcreteClass<ToExcludeImplEntity>();
            orm.Exclude<ToExcludeImplEntity>();

            orm.IsTablePerConcreteClass(typeof(ToExcludeImplEntity)).Should().Be.False();
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:9,代码来源:HierarchyClassExclusionTest.cs

示例4: GetMapping

        public HbmMapping GetMapping()
        {
            #region Initialize ConfORM

            var orm = new ObjectRelationalMapper();
            IPatternsAppliersHolder patternsAppliers =
                (new SafePropertyAccessorPack())
                    .Merge(new OneToOneRelationPack(orm))
                    .Merge(new BidirectionalManyToManyRelationPack(orm))
                    .Merge(new BidirectionalOneToManyRelationPack(orm))
                    .Merge(new DiscriminatorValueAsClassNamePack(orm))
                    .Merge(new CoolTablesNamingPack(orm))
                    .Merge(new CoolColumnsNamingPack(orm))
                    .Merge(new TablePerClassPack())
                    .Merge(new UseNoLazyForNoProxablePack()) // <== Lazy false when the class is not proxable
                    .Merge(new ConfOrm.Shop.CoolNaming.UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm))
                    .Merge(new UseCurrencyForDecimalApplier())
                    .Merge(new DatePropertyByNameApplier())
                    .Merge(new MsSQL2008DateTimeApplier());

            orm.Patterns.PoidStrategies.Add(new HighLowPoidPattern(new {max_lo = 100}));

            var mapper = new Mapper(orm, patternsAppliers);

            var domainEntities = typeof (Entity)
                .Assembly.GetTypes()
                .Where(t => (typeof (AbstractEntity<int>).IsAssignableFrom(t) || typeof (AbstractEntity<Guid>).IsAssignableFrom(t))
                    && !t.IsGenericType)
                .ToList();

            IEnumerable<Type> tablePerClassEntities = typeof (Entity)
                .Assembly.GetTypes().Where(t => IsRootEntity(t)
                                                && !tablePerClassHierarchy.Contains(t)
                                                && !tablePerConcreteClass.Contains(t)).ToList();

            // Mappings
            orm.TablePerClass(tablePerClassEntities);
            orm.TablePerClassHierarchy(tablePerClassHierarchy);
            orm.TablePerConcreteClass(tablePerConcreteClass);

            #endregion

            ConfOrmMapping(orm, mapper);

            return mapper.CompileMappingFor(domainEntities);
        }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:46,代码来源:NHibernateInitializer.cs

示例5: GetMapper

        private Mapper GetMapper()
        {
            #region Initialize ConfORM
            var inflector = new SpanishInflector();

            var orm = new ObjectRelationalMapper();

            IPatternsAppliersHolder patternsAppliers =
                (new SafePropertyAccessorPack())
                    .Merge(new SafePoidPack())
                    .Merge(new OneToOneRelationPack(orm))
                    .Merge(new BidirectionalManyToManyRelationPack(orm))
                    .Merge(new BidirectionalOneToManyRelationPack(orm))
                    .Merge(new DiscriminatorValueAsClassNamePack(orm))
                    .Merge(new PluralizedTablesPack(orm, inflector))
                    .Merge(new CoolColumnsNamingPack(orm))
                    .UnionWith(new ConfOrm.Shop.InflectorNaming.CollectionOfElementsColumnApplier(orm, inflector))
                    .Merge(new PolymorphismPack(orm))
                    .Merge(new TablePerClassPack())
                    .Merge(new UseNoLazyForNoProxablePack()) // <== Lazy false when the class is not proxable
                    .Merge(new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm))
                    .Merge(new UseCurrencyForDecimalApplier());

            // orm.Patterns.PoidStrategies.Add(new HighLowPoidPattern(new {max_lo = 100}));

            var mapper = new Mapper(orm, patternsAppliers);

            IEnumerable<Type> tablePerClassEntities =
                typeof(Entity).Assembly.GetTypes().Where(
                    t => IsRootEntity(t) && !_tablePerClassHierarchy.Contains(t) && !_tablePerConcreteClass.Contains(t)).ToList();

            // Mappings
            orm.TablePerClass(tablePerClassEntities);
            orm.TablePerClassHierarchy(_tablePerClassHierarchy);
            orm.TablePerConcreteClass(_tablePerConcreteClass);
            #endregion

            ConfOrmMapping(orm, mapper);

            return mapper;
        }
开发者ID:carlospeix,项目名称:ConfUi,代码行数:41,代码来源:NhInitializer.cs


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