Files
2026-10-08 10:43:59 +08:00

28 lines
704 B
C#

using FreeSql.DataAnnotations;
namespace F9WebAiTest.Domain.Entities.SYS.RBAC;
/// <summary>
/// 用户角色关联:用户与角色的多对多关系。
/// DDD 中作为独立关联实体,应用层直接操作其仓储(不通过 User 聚合)。
/// </summary>
[Table(Name = "sys_rbac_user_roles")]
public class UserRole : BusinessEntity
{
[Column(Name = "user_id")]
public long UserId { get; private set; }
[Column(Name = "role_id")]
public long RoleId { get; private set; }
public UserRole() { }
public UserRole(long id, long userId, long roleId)
{
Id = id;
UserId = userId;
RoleId = roleId;
CreatedAt = DateTime.UtcNow;
}
}