using System.Data.Common; using System.Data.Entity; using System.Data.Entity.ModelConfiguration.Conventions; using WePlatform.Authorization.Roles; using WePlatform.Authorization.Users; using WePlatform.BaseInfo; using WePlatform.MultiTenancy; using IwbZero.EntityFramework; using WePlatform.ThirdPartySystem; using WePlatform.WeBase; using WePlatform.WeLib; using WePlatform.WeLib.Knowledge; using WePlatform.WeModel; namespace WePlatform.EF { public class WePlatformDbContext : IwbZeroDbContext { //TODO: Define an IDbSet for your Entities... #region WE public IDbSet ThirdPartySystemInfos { get; set; } public IDbSet SceneCategoryInfos { get; set; } public IDbSet BehaviorRoleInfos { get; set; } public IDbSet RoleRelateCategoryInfos { get; set; } public IDbSet EnvironResourceInfos { get; set; } public IDbSet EnvironResourceRelatedInfos { get; set; } public IDbSet EngineInfos { get; set; } public IDbSet EngineModelInfos { get; set; } public IDbSet EvalModelInfos { get; set; } public IDbSet EvalTargetInfos { get; set; } public IDbSet EvalReportTemplateInfos { get; set; } public IDbSet EngineComponentInfos { get; set; } public IDbSet GuideInfos { get; set; } public IDbSet GuideRelatedInfos { get; set; } public IDbSet KnowledgeInfos { get; set; } public IDbSet EmergencyPlanInfos { get; set; } public IDbSet KnowledgeRelatePlanInfos { get; set; } public IDbSet EmergencyPlanContentInfos { get; set; } public IDbSet EmergencyResourceInfos { get; set; } public IDbSet BehaviorInfos { get; set; } public IDbSet BehaviorRelateRoleInfos { get; set; } public IDbSet BehaviorKnowledgeInfos { get; set; } public IDbSet SceneInfos { get; set; } public IDbSet SceneBehaviorInfos { get; set; } public IDbSet SceneFlowInfos { get; set; } public IDbSet PackageInfos { get; set; } public IDbSet PackageXmlInfos { get; set; } #endregion /* 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 SysAttachFiles { get; set; } public IDbSet SysStates { get; set; } public IDbSet SysFunctions { get; set; } public IDbSet SysHelps { get; set; } public WePlatformDbContext() : base("Default") { } /* NOTE: * This constructor is used by ABP to pass connection string defined in WePlatformDataModule.PreInitialize. * Notice that, actually you will not directly create an instance of WePlatformDbContext since ABP automatically handles it. */ public WePlatformDbContext(string nameOrConnectionString) : base(nameOrConnectionString) { } //This constructor is used in tests public WePlatformDbContext(DbConnection existingConnection) : base(existingConnection, false) { } public WePlatformDbContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //---关闭级联删除 // 禁用一对多级联删除 modelBuilder.Conventions.Remove(); // 禁用多对多级联删除 modelBuilder.Conventions.Remove(); } } }