| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- 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<Tenant, Role, User>
- {
- //TODO: Define an IDbSet for your Entities...
- #region Basic
- public IDbSet<TrainingRoleInfo> TrainingRoleInfos { get; set; }
- public IDbSet<TrainingRoleGroupInfo> TrainingRoleGroupInfos { get; set; }
- public IDbSet<TrainingGroupRelateRoleInfo> TrainingGroupRelateRoleInfos { get; set; }
- public IDbSet<TempInfo> TempInfos { get; set; }
- public IDbSet<PortraitRemarkInfo> PortraitRemarkInfos { get; set; }
- #endregion
- #region CAMP
- public IDbSet<CampInfo> CampInfos { get; set; }
- public IDbSet<CampGroupInfo> CampGroupInfos { get; set; }
- public IDbSet<GroupScoreInfo> GroupScoreInfos { get; set; }
- public IDbSet<GroupLogInfo> GroupLogInfos { get; set; }
- public IDbSet<GroupRoleInfo> GroupRoleInfos { get; set; }
- public IDbSet<CampSceneMapInfo> CampSceneMapInfos { get; set; }
- //public IDbSet<BehaviorTagInfo> BehaviorTagInfos { get; set; }
- public IDbSet<CampRelateGroupRoleInfo> CampRelateGroupRoleInfos { get; set; }
- public IDbSet<GroupPortraitInfo> 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<SysAttachFile> SysAttachFiles { get; set; }
- public IDbSet<SysState> SysStates { get; set; }
- public IDbSet<SysFunction> SysFunctions { get; set; }
- public IDbSet<SysHelp> 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<OneToManyCascadeDeleteConvention>();
- // 禁用多对多级联删除
- modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
- }
- }
- }
|