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 Group
|
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public virtual Guid GroupID { get; set; }
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual string Name { get; set; }
|
|
|
|
|
public virtual IList<RoleGroup> RoleGroups { get; set; }
|
|
|
|
|
public virtual IList<UserGroup> UserGroups { get; set; }
|
|
|
|
|
public Group()
|
|
|
|
|
{
|
|
|
|
|
RoleGroups = new List<RoleGroup>();
|
|
|
|
|
UserGroups = new List<UserGroup>();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public class GroupMap : ClassMapping<Group>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public GroupMap()
|
|
|
|
|
{
|
|
|
|
|
Table("Auth_Groups");
|
|
|
|
|
Schema("dbo");
|
|
|
|
|
Lazy(true);
|
|
|
|
|
Id(x => x.GroupID, map => map.Generator(Generators.GuidComb));
|
|
|
|
|
Property(x => x.Name, map => { map.NotNullable(true); map.Unique(true); });
|
|
|
|
|
Bag(x => x.RoleGroups, colmap => { colmap.Key(x => x.Column("GroupID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
|
|
|
|
|
Bag(x => x.UserGroups, colmap => { colmap.Key(x => x.Column("GroupID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-30 07:14:05 +00:00
|
|
|
|
}
|