70 lines
2.5 KiB
C#
70 lines
2.5 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using TIAM.Database.ModelBuilders.Users;
|
|
using TIAM.Entities.Addresses;
|
|
using TIAM.Entities.Permissions;
|
|
using TIAM.Entities.Products;
|
|
using TIAM.Entities.Profiles;
|
|
using TIAM.Entities.ServiceProviders;
|
|
using TIAM.Entities.Transfers;
|
|
using TIAM.Entities.Users;
|
|
|
|
namespace TIAM.Database.DbContexts.ServiceProviders
|
|
{
|
|
public class ServiceProviderDbContext : DbContextBase, IServiceProviderDbContext
|
|
{
|
|
public DbSet<Address> Addresses { get; set; }
|
|
public DbSet<TransferDestination> TransferDestinations { get; set; }
|
|
public DbSet<TransferDestinationToProduct> TransferDestinationToProducts { get; set; }
|
|
|
|
public DbSet<Company> Companies { get; set; }
|
|
public DbSet<UserToCompany> UserToCompanies { get; set; }
|
|
public DbSet<Profile> Profiles { get; set; }
|
|
|
|
public DbSet<User> Users { get; set; }
|
|
public DbSet<UserProductMapping> UserProductMappings { get; set; }
|
|
|
|
public DbSet<Product> Products { get; set; }
|
|
public DbSet<Company> ServiceProviders { get; set; }
|
|
|
|
|
|
public DbSet<PermissionsType> PermissionsTypes { get; set; }
|
|
public DbSet<PermissionGroup> PermissionGroups { get; set; }
|
|
public DbSet<PermissionGroupUserMapping> PermissionGroupUserMappings { get; set; }
|
|
public DbSet<PermissionContextMapping> PermissionContextMappings { get; set; }
|
|
|
|
public ServiceProviderDbContext() //: this(string.Empty)
|
|
{
|
|
|
|
}
|
|
|
|
public ServiceProviderDbContext(DbContextOptions<ServiceProviderDbContext> options) //: this(string.Empty)
|
|
{
|
|
|
|
}
|
|
|
|
public ServiceProviderDbContext(string name) : base(name)
|
|
{
|
|
}
|
|
|
|
public ServiceProviderDbContext(DbContextOptions<DbContext> options, string name) : base(options, name)
|
|
{
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
new UserEntityTypeDefaultConfiguration().Configure(modelBuilder.Entity<User>());
|
|
//new UserProductMappingEntityTypeDefaultConfiguration().Configure(modelBuilder.Entity<UserProductMapping>());
|
|
|
|
//modelBuilder.Entity<TransferDestinationToProduct>().HasOne(e => e.TransferDestination);
|
|
//modelBuilder.Entity<TransferDestinationToProduct>().Navigation(e => e.TransferDestination).AutoInclude(true);
|
|
}
|
|
}
|
|
}
|