コード例 #1
0
        /// <summary>
        /// Build all the item managers for the module
        /// </summary>
        /// <param name="db"></param>
        /// <param name="itemRepo"></param>
        /// <returns></returns>
        List <IModelManager> BuildManagers(IModuleManager moduleManager, EFCoreModuleContext db)
        {
            var managers = new List <IModelManager>
            {
                new ItemManager(moduleManager, new ItemRepo(db)),
                new MessageManager(moduleManager, new MessageDataRepo(db)),
                new VisibleItemDataManager(moduleManager, new EFVisibleItemDataRepo(db, moduleManager.GetItemRepo())),
            };

            return(managers);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public CoreModule(
            IModuleManager moduleManager)
        {
            ModuleManager = moduleManager;
            var connectionString = ModuleManager.GetConfiguration().GetConnectionString("DefaultConnection");
            var dbOptions        = new DbContextOptionsBuilder <BaseContext>();

            dbOptions.UseSqlServer(connectionString);
            Db           = new EFCoreModuleContext(dbOptions.Options);
            Managers     = BuildManagers(ModuleManager, Db);
            Repositories = Managers.SelectMany(x => x.GetRepositories()).ToList();
        }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="db">Entity framework database context</param>
 public EFVisibleItemDataRepo(
     EFCoreModuleContext db,
     IItemRepo itemRepo) : base(db, db.GetDbSet <VisibleItemData>())
 {
 }