narsil/Tanshu.Accounts.Contracts/Data Contracts/Auth/RoleGroup.cs

41 lines
1.0 KiB
C#
Raw Normal View History

using System;
using System.Runtime.Serialization;
using Tanshu.Accounts.Contracts;
using NHibernate.Mapping.ByCode.Conformist;
using NHibernate.Mapping.ByCode;
namespace Tanshu.Accounts.Entities.Auth
{
public class RoleGroup
{
public virtual Guid RoleGroupID { get; set; }
public virtual Role Role { get; set; }
public virtual Group Group { get; set; }
}
public class RoleGroupMap : ClassMapping<RoleGroup>
{
public RoleGroupMap()
{
Table("Auth_RoleGroups");
Schema("dbo");
Lazy(true);
Id(x => x.RoleGroupID, map => map.Generator(Generators.GuidComb));
ManyToOne(x => x.Role, map =>
{
map.Column("RoleID");
map.NotNullable(true);
map.Cascade(Cascade.None);
});
ManyToOne(x => x.Group, map =>
{
map.Column("GroupID");
map.NotNullable(true);
map.Cascade(Cascade.None);
});
}
}
}