using System.Data.Common; using System.Data.Entity; using System.Data.Entity.ModelConfiguration.Conventions; using ContractService.Authorization.Roles; using ContractService.Authorization.Users; using ContractService.BaseInfo; using ContractService.Client; using ContractService.LawFirm; using ContractService.Lawyer; using ContractService.LegalCase; using ContractService.LegalContract; using ContractService.MultiTenancy; using IwbZero.EntityFramework; namespace ContractService.EF { public class ContractServiceDbContext : IwbZeroDbContext { //TODO: Define an IDbSet for your Entities... /* NOTE: * Setting "Default" to base class helps us when working migration commands on Package Manager Console. * But it may cause problems when working Migrate.exe of EF. If you will apply migrations on command line, do not * pass connection string name to base classes. ABP works either way. */ /* ------------------------------------------------------------------------- */ public IDbSet LawFirmInfos { get; set; } public IDbSet LawyerInfos { get; set; } public IDbSet LegalServiceTypes { get; set; } public IDbSet LegalServiceInfos { get; set; } public IDbSet LegalServiceNoteInfos { get; set; } public IDbSet LegalContractInfos { get; set; } public IDbSet LegalContractSupplementInfos { get; set; } public IDbSet LegalContractContentInfos { get; set; } public IDbSet LegalContractKeyPointInfos { get; set; } public IDbSet LegalContractNoteInfos { get; set; } public IDbSet LawyerRelatedInfos { get; set; } public IDbSet ClientCompanyInfos { get; set; } public IDbSet ClientOrganizationInfos { get; set; } public IDbSet ClientStaffInfos { get; set; } public IDbSet StaffRelateInfos { get; set; } public IDbSet SysAttachFiles { get; set; } public IDbSet SysStates { get; set; } public IDbSet SysFunctions { get; set; } public IDbSet SysHelps { get; set; } public IDbSet SysQueryInfos { get; set; } public ContractServiceDbContext() : base("Default") { } /* NOTE: * This constructor is used by ABP to pass connection string defined in ContractServiceDataModule.PreInitialize. * Notice that, actually you will not directly create an instance of ContractServiceDbContext since ABP automatically handles it. */ public ContractServiceDbContext(string nameOrConnectionString) : base(nameOrConnectionString) { } //This constructor is used in tests public ContractServiceDbContext(DbConnection existingConnection) : base(existingConnection, false) { } public ContractServiceDbContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //---关闭级联删除 // 禁用一对多级联删除 modelBuilder.Conventions.Remove(); // 禁用多对多级联删除 modelBuilder.Conventions.Remove(); } } }