| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 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<Tenant, Role, User>
- {
- //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<LawFirmInfo> LawFirmInfos { get; set; }
- public IDbSet<LawyerInfo> LawyerInfos { get; set; }
- public IDbSet<LegalServiceType> LegalServiceTypes { get; set; }
- public IDbSet<LegalCaseInfo> LegalServiceInfos { get; set; }
- public IDbSet<LegalCaseNoteInfo> LegalServiceNoteInfos { get; set; }
- public IDbSet<LegalContractInfo> LegalContractInfos { get; set; }
- public IDbSet<LegalContractSupplementInfo> LegalContractSupplementInfos { get; set; }
- public IDbSet<LegalContractContentInfo> LegalContractContentInfos { get; set; }
- public IDbSet<LegalContractKeyPointInfo> LegalContractKeyPointInfos { get; set; }
- public IDbSet<LegalContractNoteInfo> LegalContractNoteInfos { get; set; }
- public IDbSet<LawyerRelatedInfo> LawyerRelatedInfos { get; set; }
- public IDbSet<ClientCompanyInfo> ClientCompanyInfos { get; set; }
- public IDbSet<OrganizationInfo> ClientOrganizationInfos { get; set; }
- public IDbSet<ClientStaffInfo> ClientStaffInfos { get; set; }
- public IDbSet<StaffRelatedInfo> StaffRelateInfos { get; set; }
- public IDbSet<SysAttachFile> SysAttachFiles { get; set; }
- public IDbSet<SysState> SysStates { get; set; }
- public IDbSet<SysFunction> SysFunctions { get; set; }
- public IDbSet<SysHelp> SysHelps { get; set; }
- public IDbSet<SysQuery> 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<OneToManyCascadeDeleteConvention>();
- // 禁用多对多级联删除
- modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
- }
- }
- }
|