Now the mapping classes
- public abstract class ModelBaseMap<T> : ClassMap<T> where T :
Model.Base.ModelBase
  Abstract empty base class
- public class GenericModelMap<T, TId> : ModelBaseMap<T> where T :
GenericModelBase<TId>
  Another one...
- public abstract class VersionModelBaseMap<T> : GenericModelMap<T,
long> where T : VersionModelBase
        {
                protected const string NotDeletedSqlWhereClause = "DeletedOn is
NULL";

                protected VersionModelBaseMap()
                {
                        // ReSharper disable 
DoNotCallOverridableMethodsInConstructor
                        Id(x => x.Id).UnsavedValue(VersionModelBase.UnsavedId);
                        // ReSharper restore 
DoNotCallOverridableMethodsInConstructor
                        Version(x => x.Version);
                        Map(x => x.DeletedOn);
                        Where(NotDeletedSqlWhereClause);
                }
        }
- And finally:
        public class ProductQuotationMap :
VersionModelBaseMap<ProductQuotation>
        {
                public ProductQuotationMap()
                {
                        Table("ProductQuotations");
                        Map(x => x.Name).Length(100).Not.Nullable();
                        Map(x => x.Group).Column("GroupName").Length(100);
                        Map(x => x.Description).Length(500).Not.Nullable();
                        Map(x => x.Format).Length(100).Not.Nullable();
                        Map(x => x.Color).Length(100).Not.Nullable();
                        Map(x => 
x.PrinterType).CustomType<long>().Not.Nullable();
                        Map(x => x.PaperType).Length(100).Not.Nullable();
                        Map(x => x.PaperWeight).Length(100).Not.Nullable();
                        References(x =>
x.PaperFormat).Column("IdPaperFormat").Not.Nullable().Not.LazyLoad();
                        References(x =>
x.PrintFormat).Column("IdPrintFormat").Not.Nullable().Not.LazyLoad();
                        Map(x => 
x.PaperCostType).CustomType<long>().Not.Nullable();
                        Map(x => x.PaperUnitCost).Not.Nullable();
                        Map(x => x.PaperReamWeight);
                        Map(x => x.GraphicCost).Not.Nullable();
                        Map(x => 
x.PhotolithographyEquipmentCost).Not.Nullable();
                        Map(x => 
x.CostOptions).CustomType<long>().Not.Nullable();
                        References(x => x.Quotation).Column("IdQuotation");
                        HasMany(x =>
x.Editions).AsSet().Inverse().KeyColumn("IdProductQuotation").Cascade.None().Where(NotDeletedSqlWhereClause);
                }
        }

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to