using System.Data.Common; using System.Data.Entity; using System.Data.Entity.ModelConfiguration.Conventions; using WeApp.Authorization.Roles; using WeApp.Authorization.Users; using WeApp.BaseInfo; using WeApp.MultiTenancy; using IwbZero.EntityFramework; using WeApp.BasicInfo; using WeApp.TrainingCamp; namespace WeApp.EF { public class WeAppDbContext : IwbZeroDbContext { //TODO: Define an IDbSet for your Entities... #region Basic public IDbSet TrainingRoleInfos { get; set; } public IDbSet TrainingRoleGroupInfos { get; set; } public IDbSet TrainingGroupRelateRoleInfos { get; set; } public IDbSet TempInfos { get; set; } public IDbSet PortraitRemarkInfos { get; set; } #endregion #region CAMP public IDbSet CampInfos { get; set; } public IDbSet CampGroupInfos { get; set; } public IDbSet GroupScoreInfos { get; set; } public IDbSet GroupLogInfos { get; set; } public IDbSet GroupRoleInfos { get; set; } public IDbSet CampSceneMapInfos { get; set; } //public IDbSet BehaviorTagInfos { get; set; } public IDbSet CampRelateGroupRoleInfos { get; set; } public IDbSet GroupPortraitInfos { get; set; } //public IDbSet<> s { 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 WeAppDbContext() : base("Default") { } /* NOTE: * This constructor is used by ABP to pass connection string defined in WeAppDataModule.PreInitialize. * Notice that, actually you will not directly create an instance of WeAppDbContext since ABP automatically handles it. */ public WeAppDbContext(string nameOrConnectionString) : base(nameOrConnectionString) { } //This constructor is used in tests public WeAppDbContext(DbConnection existingConnection) : base(existingConnection, false) { } public WeAppDbContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //---关闭级联删除 // 禁用一对多级联删除 modelBuilder.Conventions.Remove(); // 禁用多对多级联删除 modelBuilder.Conventions.Remove(); } } }