76 lines
2.7 KiB
C#
76 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using AyCode.Database.DbContexts;
|
|
using AyCode.Database.DbContexts.Users;
|
|
using AyCode.Entities.Users;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using TIAM.Database.DbContexts.Users;
|
|
using TIAM.Database.DbSets.Users;
|
|
using TIAM.Database.ModelBuilders.Products;
|
|
using TIAM.Database.ModelBuilders.Users;
|
|
using TIAM.Entities.Addresses;
|
|
using TIAM.Entities.Permissions;
|
|
using TIAM.Entities.Products;
|
|
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<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);
|
|
}
|
|
}
|
|
}
|