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

41 lines
1.6 KiB
C#
Raw Normal View History

2011-01-22 12:38:30 +00:00
using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
using NHibernate.Mapping.ByCode.Conformist;
using NHibernate.Mapping.ByCode;
2011-01-22 12:38:30 +00:00
namespace Tanshu.Accounts.Entities
2011-01-22 12:38:30 +00:00
{
public class Modifier
2011-01-22 12:38:30 +00:00
{
public Modifier()
{
ProductGroupModifiers = new List<ProductGroupModifier>();
InventoryModifiers = new List<InventoryModifier>();
}
public virtual Guid ModifierID { get; set; }
public virtual string Name { get; set; }
public virtual bool ShowInBill { get; set; }
public virtual decimal Price { get; set; }
public virtual IList<ProductGroupModifier> ProductGroupModifiers { get; set; }
public virtual IList<InventoryModifier> InventoryModifiers { get; set; }
}
public class ModifierMap : ClassMapping<Modifier>
{
public ModifierMap()
{
Table("Modifiers");
Schema("dbo");
Lazy(true);
Id(x => x.ModifierID, m => m.Generator(Generators.GuidComb));
Property(x => x.Name, map => { map.NotNullable(true); map.Unique(true); });
Property(x => x.ShowInBill, map => { map.NotNullable(true); });
Property(x => x.Price, map => { map.NotNullable(true); });
Bag(x => x.InventoryModifiers, colmap => { colmap.Key(x => x.Column("ModifierID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
Bag(x => x.ProductGroupModifiers, colmap => { colmap.Key(x => x.Column("ModifierID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
}
2011-01-22 12:38:30 +00:00
}
}