protected override void Apply(IConventionFinder conventionFinder) { conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>(); conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>(); conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseString.Convention>(); conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X")); }
/// <summary> /// Map the convention. /// </summary> /// <param name="finder">Convention finder.</param> public virtual void Build(IConventionFinder finder) { finder.Add <PrimaryKeyConvention>(); finder.Add <PrimaryKeyGuidConvention>(); finder.Add(DefaultCascade.None()); finder.Add(ForeignKey.EndsWith("Id")); }
protected override void Apply(IConventionFinder conventionFinder) { conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>(); conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>(); conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseString.Convention>(); conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X")); }
private static void ConfigureConventions(IConventionFinder conventions) { conventions.Add(DefaultCascade.All()); conventions.Add(DefaultLazy.Always()); conventions.Add(ConventionBuilder.Id.Always(convention => convention.GeneratedBy.GuidComb())); conventions.Add(ConventionBuilder.HasMany.Always(convention => convention.Inverse())); conventions.Add(ConventionBuilder.HasMany.Always(convention => convention.Cascade.AllDeleteOrphan())); }
protected override void Apply(IConventionFinder conventionFinder) { conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>(); conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>(); //conventionFinder.Add<NHibernate.Extension.Convention.UpperCaseString.Convention>(); conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X")); conventionFinder.Add(new Dao.NHibernate.Extension.Convention.Eumeration.Convention()); conventionFinder.Add(DynamicUpdate.AlwaysTrue()); }
protected override void Apply(IConventionFinder conventionFinder) { conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>(); conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>(); //conventionFinder.Add<NHibernate.Extension.Convention.UpperCaseString.Convention>(); conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X")); conventionFinder.Add(new Dao.NHibernate.Extension.Convention.Eumeration.Convention()); conventionFinder.Add(DynamicUpdate.AlwaysTrue()); }
/// <summary> /// The add conventions. /// </summary> /// <param name="conventions"> /// The conventions. /// </param> protected virtual void AddConventions(IConventionFinder conventions) { // uncomment lines if needed conventions.Add(new ForeignKeyConstraintHasManyNameConvention()); conventions.Add(new ForeignKeyConstraintReferenceNameConvention()); conventions.Add(new ForeignKeyNameConvention()); conventions.Add(new ManyToManyNameConvention()); conventions.Add(new ReferenceNameConvention()); conventions.Add(new ForeignKeyConstraintHasManyToManyNameConvention()); conventions.Add(new TableNameConvention()); conventions.Add(new PrimaryKeyNameConvention()); conventions.Add(new PropertyNameConvention()); conventions.Add(new EnumConvention()); }
private void AddValidation(IConventionFinder finder) { finder.Add<RequiredAttributeConvention>(); finder.Add<MaximumStingLengthConvention>(); }
public virtual void AddReferenceConvention(IConventionFinder conventionFinder) { conventionFinder.Add <ReferenceConvention>(); }
public TReturn Add <T>() where T : IConvention { conventionFinder.Add <T>(); return(parent); }
public virtual void AddManyToManyConvention(IConventionFinder conventionFinder) { conventionFinder.Add <ManyToManyConvention>(); }
public virtual void AddTableNameConvention(IConventionFinder conventionFinder) { conventionFinder.Add <TableNameConvention>(); }
public virtual void AddHasManyConvention(IConventionFinder conventionFinder) { conventionFinder.Add <HasManyConvention>(); }
public virtual void AddPrimaryKeyConvention(IConventionFinder conventionFinder) { conventionFinder.Add <PrimaryKeyConvention>(); }
public void Apply(string sessionAlias, IConventionFinder conventionFinder) { conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("DTC")); }
/* private static Action<AutoMappingExpressions> GetSetup() { return c => { c.FindIdentity = member => member.Name == "Id"; c.IsConcreteBaseType = IsBaseTypeConvention; c.AbstractClassIsLayerSupertype = type => !IsDomainEntity(type); c.IsComponentType = IsComponentTypeConvention; }; } private static bool IsDomainEntity(Type type) { return GetAutoMappingFilter(type) && type.Assembly == typeof(Player).Assembly && type != typeof(SummarisableEntity); }*/ /// <summary> /// This project's conventions (which may be changed) are as follows: /// * Table names are plural /// * The Id of an object is "Id" /// * Foreign keys are "ObjectNameFk" /// * One-to-Many relationships cascade "All" /// /// Feel free to change this to your project's needs! /// </summary> private static void GetConventions(IConventionFinder finder) { finder.Add(Table.Is(map => Inflector.Net.Inflector.Pluralize(map.EntityType.Name))); //c.FindIdentity = type => type.Name == "Id"; finder.Add(PrimaryKey.Name.Is(map => "Id")); //c.GetForeignKeyName = type => type.Name + "Fk"; finder.Add(ForeignKey.EndsWith("Fk")); //c.GetForeignKeyNameOfParent = type => type.Name + "Fk"; //c.OneToManyConvention = o => o.Cascade.All(); finder.Add(ConventionBuilder.Reference.Always(r => r.Cascade.SaveUpdate())); finder.Add(ConventionBuilder.HasMany.Always(r => r.Cascade.All())); finder.Add(ConventionBuilder.HasManyToMany.Always(r => r.Cascade.All())); //finder.Add(new RequiredConvention()); //finder.Add(new SetConvention()); //finder.Add(new BlobDocumentConvention()); //finder.Add(new StringLengthConvention()); //finder.Add(new ValueTypePropertyConvention()); }