2011-01-30 07:14:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
using System.Collections.Generic;
|
2011-02-18 16:54:48 +00:00
|
|
|
|
using Tanshu.Accounts.Contracts;
|
2014-10-12 09:41:45 +00:00
|
|
|
|
using NHibernate.Mapping.ByCode.Conformist;
|
|
|
|
|
using NHibernate.Mapping.ByCode;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.Entities.Auth
|
|
|
|
|
{
|
|
|
|
|
public class Role
|
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public virtual Guid RoleID { get; set; }
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual string Name { get; set; }
|
|
|
|
|
public virtual IList<RoleGroup> Groups { get; set; }
|
2014-10-12 09:41:45 +00:00
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public Role()
|
|
|
|
|
{
|
|
|
|
|
Groups = new List<RoleGroup>();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public class RoleMap : ClassMapping<Role>
|
|
|
|
|
{
|
|
|
|
|
public RoleMap()
|
|
|
|
|
{
|
|
|
|
|
Table("Auth_Roles");
|
|
|
|
|
Schema("dbo");
|
|
|
|
|
Lazy(true);
|
|
|
|
|
Id(x => x.RoleID, map => map.Generator(Generators.GuidComb));
|
|
|
|
|
Property(x => x.Name, map => { map.NotNullable(true); map.Unique(true); });
|
|
|
|
|
Bag(x => x.Groups, colmap => { colmap.Key(x => x.Column("RoleID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
}
|