本文整理汇总了C#中FluentNHibernate类的典型用法代码示例。如果您正苦于以下问题:C# FluentNHibernate类的具体用法?C# FluentNHibernate怎么用?C# FluentNHibernate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FluentNHibernate类属于命名空间,在下文中一共展示了FluentNHibernate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IIdentityInstance instance)
{
instance.Column("Id");
instance.UnsavedValue("0");
//instance.GeneratedBy.Identity();
//instance.GeneratedBy.HiLo("1000");
}
示例2: GetKeyName
protected override string GetKeyName(FluentNHibernate.Member property, Type type)
{
if (property == null)
return type.Name + "ID";
return property.Name + "ID";
}
示例3: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IIdentityInstance instance)
{
if (Attribute.IsDefined(instance.EntityType, typeof(GeneratedByAssignedAttribute)))
instance.GeneratedBy.Assigned();
else
instance.Column("Id");
}
示例4: GetKeyName
protected override string GetKeyName(FluentNHibernate.Member property, Type type)
{
if (property == null)
return type.Name + "ID"; // many-to-many, one-to-many, join
return property.Name + "ID"; // many-to-one
}
示例5: GetKeyName
protected override string GetKeyName(FluentNHibernate.Member property, Type type)
{
if (property == null)
return "fk_" + type.Name;
return "fk_" + property.Name;
}
示例6: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IOneToManyCollectionInstance instance)
{
instance.Key.Column(instance.EntityType.Name + "Id");
instance.Cascade.AllDeleteOrphan();
instance.Inverse();
instance.Access.CamelCaseField(CamelCasePrefix.Underscore);//http://stackoverflow.com/questions/781443/private-collection-mapping-in-fluent-nhibernate
}
示例7: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IOneToManyCollectionInstance instance)
{
instance.Generic();
instance.LazyLoad();
instance.Fetch.Select();
instance.BatchSize(10);
}
示例8: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IIdentityInstance instance)
{
if (instance.EntityType.BaseType != typeof (IntEntity))
instance.GeneratedBy.Assigned();
instance.UniqueKey("PK_" + instance.EntityType.Name);
}
示例9: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IVersionInstance instance)
{
instance.Column("RowVersion");
instance.Not.Nullable();
instance.UnsavedValue("0");
instance.Default(1);
}
示例10: ShouldMap
public override bool ShouldMap(FluentNHibernate.Member member)
{
if (member.IsProperty && !member.CanWrite)
{
return false;
}
return base.ShouldMap(member);
}
示例11: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IPropertyInstance instance)
{
var regexString = @"([A-Z][\w^[A-Z]]*)([A-Z][\w^[A-Z]]*)*";
var newName = Regex.Replace(instance.Name, regexString, (m => (m.Index != 0 ? "_" : "") + m.Value.ToLower()));
instance.Column(newName);
}
示例12: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IOneToManyCollectionInstance instance)
{
instance.Key.Column(instance.EntityType.Name + "Id");
instance.Key.ForeignKey(instance.EntityType.Name+"_"+instance.ChildType.Name+"_FK");
instance.Cascade.AllDeleteOrphan();
instance.Inverse();
instance.LazyLoad();
}
示例13: GetKeyName
protected override string GetKeyName(FluentNHibernate.Member property, Type type)
{
if (property == null)
return type.Name + "Id";
// make foreign key compatible with Entity Framework
return type.Name + "_" + property.Name + "Id";
}
示例14: GetKeyName
protected override string GetKeyName(FluentNHibernate.Member property, Type type)
{
if (property == null || typeof(Entity) == type.BaseType)
{
return type.Name + "Id";
}
return property.Name + "Id";
}
示例15: Apply
public void Apply(FluentNHibernate.Conventions.Instances.IManyToManyCollectionInstance instance)
{
if (instance.OtherSide == null)
{
instance.Table(
string.Format(
"{0}To{1}",
instance.EntityType.Name + "_Id",
instance.ChildType.Name + "_Id"));
}
else
{
instance.Inverse();
}
instance.Cascade.All();
}