DocSpace-client/common/ASC.Core.Common/EF/Context/UserDbContext.cs

41 lines
1.3 KiB
C#
Raw Normal View History

2019-11-29 12:26:53 +00:00
using Microsoft.EntityFrameworkCore;
2019-12-02 12:04:22 +00:00
using Microsoft.Extensions.DependencyInjection;
2019-11-25 09:49:12 +00:00
namespace ASC.Core.Common.EF
{
2019-11-25 11:49:21 +00:00
public class UserDbContext : BaseDbContext
2019-11-25 09:49:12 +00:00
{
public DbSet<User> Users { get; set; }
public DbSet<UserSecurity> UserSecurity { get; set; }
public DbSet<UserPhoto> Photos { get; set; }
public DbSet<Acl> Acl { get; set; }
public DbSet<DbGroup> Groups { get; set; }
public DbSet<UserGroup> UserGroups { get; set; }
public DbSet<Subscription> Subscriptions { get; set; }
2019-12-02 12:04:22 +00:00
public DbSet<DbSubscriptionMethod> SubscriptionMethods { get; set; }
2019-11-25 09:49:12 +00:00
2019-12-17 08:27:38 +00:00
public UserDbContext() { }
public UserDbContext(DbContextOptions<UserDbContext> options)
: base(options)
{
}
2019-11-25 11:49:21 +00:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
2019-11-25 09:49:12 +00:00
{
2019-12-17 13:01:59 +00:00
modelBuilder
.AddAcl()
.AddSubscription()
.AddSubscriptionMethod()
.AddUser();
2019-11-25 09:49:12 +00:00
}
}
2019-12-02 12:04:22 +00:00
public static class UserDbExtension
{
public static IServiceCollection AddUserDbContextService(this IServiceCollection services)
{
2019-12-10 15:06:51 +00:00
return services.AddDbContextManagerService<UserDbContext>();
2019-12-02 12:04:22 +00:00
}
}
2019-11-25 09:49:12 +00:00
}