本文整理汇总了C#中ObjectRelationalMapper.Component方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectRelationalMapper.Component方法的具体用法?C# ObjectRelationalMapper.Component怎么用?C# ObjectRelationalMapper.Component使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectRelationalMapper
的用法示例。
在下文中一共展示了ObjectRelationalMapper.Component方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMapings
public static HbmMapping GetMapings(ObjectRelationalMapper orm)
{
domainEntities =
typeof(Entity).Assembly.GetTypes()
.Where(t => typeof(Entity).IsAssignableFrom(t) && !t.IsGenericType)
.ToList();
orm.Cascade<Claim, CPS.Domain.Action>(CascadeOn.None);
orm.Cascade<Branch, Claim>(CascadeOn.None);
orm.Cascade<Domain.Action,Document>(CascadeOn.All);
orm.Component<Address>();
orm.Component<Incident>();
orm.Component<ContactInfo>();
var patterns = new SafePropertyAccessorPack().Merge(new OneToOneRelationPack(orm))
.Merge(new BidirectionalManyToManyRelationPack(orm))
.Merge(new BidirectionalOneToManyRelationPack(orm))
.Merge(new DiscriminatorValueAsClassNamePack(orm))
.Merge(new CoolColumnsNamingPack(orm))
.Merge(new TablePerClassPack())
.Merge(new ListIndexAsPropertyPosColumnNameApplier())
.Merge(new PluralizedTablesPack(orm, new EnglishInflector()))
.Merge(new MsSQL2008DateTimeApplier());
var mapper = new Mapper(orm, patterns);
var mapping = mapper.CompileMappingFor(domainEntities);
Debug.WriteLine(mapping.AsString());
return mapping;
}
示例2: 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>();
}
示例3: CanDiscoverManyToOneFromComponentToEntity
public void CanDiscoverManyToOneFromComponentToEntity()
{
var orm = new ObjectRelationalMapper();
orm.TablePerClass<AEntity>();
orm.TablePerClass<BEntity>();
orm.Component<AComponent>();
orm.IsManyToOne(typeof(AComponent), typeof(BEntity)).Should().Be.True();
}
示例4: WhenComponentRegisteredIsRecognized
public void WhenComponentRegisteredIsRecognized()
{
var mapper = new ObjectRelationalMapper();
mapper.Component<AComponent>();
mapper.IsComponent(typeof(AComponent)).Should().Be.True();
}