public override async Task UninstallAsync(IServiceProvider serviceProvider, Func <Task> unsinstallFunc)
        {
            DatabaseToolkitEntities mySenparcEntities = serviceProvider.GetService <DatabaseToolkitEntities>();

            //指定需要删除的数据实体

            var dropTableKeys = EntitySetKeys.GetEntitySetInfo(this.XncfDatabaseDbContextType).Keys.ToArray();
            //删除数据库表
            await base.DropTablesAsync(serviceProvider, mySenparcEntities, dropTableKeys);

            await base.UninstallAsync(serviceProvider, unsinstallFunc).ConfigureAwait(false);
        }
Example #2
0
        public override async Task UninstallAsync(IServiceProvider serviceProvider, Func <Task> unsinstallFunc)
        {
            #region  除数据库(演示)

            var mySenparcEntitiesType = this.TryGetXncfDatabaseDbContextType;
            DatabaseToolkitEntities mySenparcEntities = serviceProvider.GetService(mySenparcEntitiesType) as DatabaseToolkitEntities;

            //指定需要删除的数据实体

            //注意:这里作为演示,在卸载模块的时候删除了所有本模块创建的表,实际操作过程中,请谨慎操作,并且按照删除顺序对实体进行排序!
            var dropTableKeys = EntitySetKeys.GetEntitySetInfo(this.TryGetXncfDatabaseDbContextType).Keys.ToArray();
            await base.DropTablesAsync(serviceProvider, mySenparcEntities, dropTableKeys);

            #endregion

            await unsinstallFunc().ConfigureAwait(false);
        }