2019-11-25 09:49:12 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2019-12-17 13:01:59 +00:00
|
|
|
|
|
2019-12-03 15:20:21 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2019-11-25 09:49:12 +00:00
|
|
|
|
|
|
|
|
|
namespace ASC.Core.Common.EF
|
|
|
|
|
{
|
|
|
|
|
[Table("core_usergroup")]
|
2019-12-17 13:01:59 +00:00
|
|
|
|
public class UserGroup : BaseEntity
|
2019-11-25 09:49:12 +00:00
|
|
|
|
{
|
|
|
|
|
public int Tenant { get; set; }
|
|
|
|
|
|
|
|
|
|
public Guid UserId { get; set; }
|
|
|
|
|
|
|
|
|
|
public Guid GroupId { get; set; }
|
|
|
|
|
|
|
|
|
|
[Column("ref_type")]
|
|
|
|
|
public UserGroupRefType RefType { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool Removed { get; set; }
|
|
|
|
|
|
|
|
|
|
[Column("last_modified")]
|
|
|
|
|
public DateTime LastModified { get; set; }
|
2019-12-17 13:01:59 +00:00
|
|
|
|
|
2020-02-21 12:38:04 +00:00
|
|
|
|
public override object[] GetKeys()
|
2019-12-17 13:01:59 +00:00
|
|
|
|
{
|
|
|
|
|
return new object[] { Tenant, UserId, GroupId, RefType };
|
|
|
|
|
}
|
2019-11-25 09:49:12 +00:00
|
|
|
|
}
|
2019-12-03 15:20:21 +00:00
|
|
|
|
|
|
|
|
|
public static class DbUserGroupExtension
|
|
|
|
|
{
|
|
|
|
|
public static void AddUserGroup(this ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder.Entity<UserGroup>()
|
|
|
|
|
.HasKey(c => new { c.Tenant, c.UserId, c.GroupId, c.RefType });
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-25 09:49:12 +00:00
|
|
|
|
}
|