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"));
 }
Exemplo n.º 2
0
 /// <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"));
 }
Exemplo n.º 4
0
 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()));
 }
Exemplo n.º 5
0
 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());
 }
Exemplo n.º 7
0
 /// <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>();
 }
Exemplo n.º 9
0
 public virtual void AddReferenceConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <ReferenceConvention>();
 }
Exemplo n.º 10
0
 public TReturn Add <T>() where T : IConvention
 {
     conventionFinder.Add <T>();
     return(parent);
 }
Exemplo n.º 11
0
 public virtual void AddManyToManyConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <ManyToManyConvention>();
 }
Exemplo n.º 12
0
 public virtual void AddTableNameConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <TableNameConvention>();
 }
Exemplo n.º 13
0
 public virtual void AddHasManyConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <HasManyConvention>();
 }
Exemplo n.º 14
0
 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"));
 }
 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());
        }