2014-10-12 09:41:45 +00:00
|
|
|
|
using NHibernate.Mapping.ByCode.Conformist;
|
|
|
|
|
using NHibernate.Mapping.ByCode;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System;
|
|
|
|
|
namespace Tanshu.Accounts.Entities
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public class Customer
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public virtual Guid CustomerID { get; set; }
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual string Name { get; set; }
|
|
|
|
|
public virtual string Address { get; set; }
|
|
|
|
|
public virtual bool Important { get; set; }
|
|
|
|
|
public virtual string Phone { get; set; }
|
|
|
|
|
public virtual string Remarks { get; set; }
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public virtual IList<Voucher> Vouchers { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class CustomerMap : ClassMapping<Customer>
|
|
|
|
|
{
|
|
|
|
|
public CustomerMap()
|
|
|
|
|
{
|
|
|
|
|
Table("Customers");
|
|
|
|
|
Schema("dbo");
|
|
|
|
|
Lazy(true);
|
|
|
|
|
Id(x => x.CustomerID, map => map.Generator(Generators.GuidComb));
|
|
|
|
|
Property(x => x.Name, map => { map.NotNullable(true); map.Unique(true); });
|
|
|
|
|
Property(x => x.Address);
|
|
|
|
|
Property(x => x.Important);
|
|
|
|
|
Property(x => x.Phone);
|
|
|
|
|
Property(x => x.Remarks);
|
|
|
|
|
Bag(x => x.Vouchers, colmap => { colmap.Key(x => x.Column("CustomerID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|