本文整理汇总了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>();
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}