narsil/Tanshu.Accounts.Contracts/Data Contracts/CustomerBO.cs

34 lines
1.2 KiB
C#
Raw Normal View History

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
{
public class Customer
2010-03-02 17:56:21 +00:00
{
public virtual Guid CustomerID { get; set; }
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; }
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
}
}