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

42 lines
1.1 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;
using System.Collections.Generic;
namespace Tanshu.Accounts.Entities.Auth
{
public class UserGroup
{
public virtual Guid UserGroupID { get; set; }
public virtual User User { get; set; }
public virtual Group Group { get; set; }
}
public class UserGroupMap : ClassMapping<UserGroup>
{
public UserGroupMap()
{
Table("Auth_UserGroups");
Schema("dbo");
Lazy(true);
Id(x => x.UserGroupID, map => map.Generator(Generators.GuidComb));
ManyToOne(x => x.User, map =>
{
map.Column("UserID");
map.NotNullable(true);
map.Cascade(Cascade.None);
});
ManyToOne(x => x.Group, map =>
{
map.Column("GroupID");
map.NotNullable(true);
map.Cascade(Cascade.None);
});
}
}
}