Example #1
0
        public async Task StartAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                using var scope = _serviceProvider.CreateScope();
                IDataSeedContributor dataSeedContributor = scope.ServiceProvider.GetRequiredService <IDataSeedContributor>();
                await dataSeedContributor.SeedPermissionAsync();

                await dataSeedContributor.InitAdminPermission();
            }
            catch (Exception ex)
            {
                _logger.LogError("初始化数据失败!!!", ex);
            };
        }
Example #2
0
        public async Task StartAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                using var scope = _serviceProvider.CreateScope();
                IDataSeedContributor dataSeedContributor = scope.ServiceProvider.GetRequiredService <IDataSeedContributor>();

                var permissions = ReflexHelper.GetAssemblyLinCmsAttributes();
                await dataSeedContributor.SeedPermissionAsync(permissions);

                await dataSeedContributor.InitAdminPermission();
            }
            catch (Exception ex)
            {
                _logger.LogError($"初始化数据失败!!!{ex.Message}{ex.StackTrace}{ex.InnerException}");
            };
        }