using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using DataAccess.Domain.Entities;

namespace DataAccess.NHDal.Maps {
	public class CategoryMap : ClassMap<Category> {
		public CategoryMap() {
			Table("Category");

			Id(x => x.Id, "CategoryID").GeneratedBy.Identity();

			Map(x => x.Name, "CategoryName").Not.Nullable();

			References(x => x.ParentCategory).Column("SubCategoryOf");

			HasMany<Category>(x => x.ChildCategory).KeyColumn("SubCategoryOf").Inverse();

			//Version(x => x.Version);
		}
	}
}
