Browse Source

Use new IDataSeeder.

pull/947/head
Halil ibrahim Kalkan 8 years ago
parent
commit
65a2d89b18
  1. 16
      abp_io/src/Volo.AbpWebSite.Web/AbpWebSiteWebModule.cs
  2. 14
      modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs
  3. 16
      modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs
  4. 16
      samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs
  5. 14
      templates/module/app/MyCompanyName.MyProjectName.DemoApp/DemoAppModule.cs
  6. 20
      templates/mvc/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs
  7. 9
      templates/mvc/test/MyCompanyName.MyProjectName.Application.Tests/MyProjectNameTestDataBuilder.cs

16
abp_io/src/Volo.AbpWebSite.Web/AbpWebSiteWebModule.cs

@ -1,5 +1,4 @@
using System.IO; using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -14,7 +13,6 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theming; using Volo.Abp.AspNetCore.Mvc.UI.Theming;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -182,18 +180,8 @@ namespace Volo.AbpWebSite
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
await scope.ServiceProvider await scope.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>() .GetRequiredService<IDataSeeder>()
.SeedAsync( .SeedAsync();
"1q2w3E*"
);
await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>()
.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll().Union(BloggingPermissions.GetAll())
);
}); });
} }
} }

14
modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs

@ -159,18 +159,8 @@ namespace Volo.BloggingTestApp
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
await scope.ServiceProvider await scope.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>() .GetRequiredService<IDataSeeder>()
.SeedAsync( .SeedAsync();
"1q2w3E*"
);
await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>()
.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll().Union(BloggingPermissions.GetAll())
);
}); });
} }
} }

16
modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs

@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Localization;
@ -16,7 +15,6 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theming; using Volo.Abp.AspNetCore.Mvc.UI.Theming;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -136,19 +134,9 @@ namespace Volo.DocsTestApp
{ {
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
await context.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>()
.SeedAsync(
"1q2w3E*"
);
await scope.ServiceProvider await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>() .GetRequiredService<IDataSeeder>()
.SeedAsync( .SeedAsync();
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll().Union(DocsAdminPermissions.GetAll())
);
}); });
} }
} }

16
samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs

@ -11,6 +11,7 @@ using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Identity; using Volo.Abp.Identity;
@ -93,21 +94,10 @@ namespace AuthServer.Host
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
await scope.ServiceProvider await scope.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>() .GetRequiredService<IDataSeeder>()
.SeedAsync( .SeedAsync();
adminUserPassword: "1q2w3E*"
);
await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>()
.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll()
);
}); });
} }
} }
} }
} }

14
templates/module/app/MyCompanyName.MyProjectName.DemoApp/DemoAppModule.cs

@ -123,18 +123,8 @@ namespace MyCompanyName.MyProjectName.DemoApp
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
await scope.ServiceProvider await scope.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>() .GetRequiredService<IDataSeeder>()
.SeedAsync( .SeedAsync();
"1q2w3E*"
);
await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>()
.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll().Union(MyProjectNamePermissions.GetAll())
);
}); });
} }
} }

20
templates/mvc/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs

@ -20,6 +20,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Data;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Identity.Web; using Volo.Abp.Identity.Web;
using Volo.Abp.Localization; using Volo.Abp.Localization;
@ -195,22 +196,9 @@ namespace MyCompanyName.MyProjectName
{ {
AsyncHelper.RunSync(async () => AsyncHelper.RunSync(async () =>
{ {
var identitySeedResult = await scope.ServiceProvider await scope.ServiceProvider
.GetRequiredService<IIdentityDataSeeder>() .GetRequiredService<IDataSeeder>()
.SeedAsync( .SeedAsync();
"1q2w3E*"
);
if (identitySeedResult.CreatedAdminRole)
{
await scope.ServiceProvider
.GetRequiredService<IPermissionDataSeeder>()
.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
IdentityPermissions.GetAll().Union(MyProjectNamePermissions.GetAll())
);
}
}); });
} }
} }

9
templates/mvc/test/MyCompanyName.MyProjectName.Application.Tests/MyProjectNameTestDataBuilder.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Threading; using Volo.Abp.Threading;
@ -7,11 +8,11 @@ namespace MyCompanyName.MyProjectName
{ {
public class MyProjectNameTestDataBuilder : ITransientDependency public class MyProjectNameTestDataBuilder : ITransientDependency
{ {
private readonly IIdentityDataSeeder _identityDataSeeder; private readonly IDataSeeder _dataSeeder;
public MyProjectNameTestDataBuilder(IIdentityDataSeeder identityDataSeeder) public MyProjectNameTestDataBuilder(IDataSeeder dataSeeder)
{ {
_identityDataSeeder = identityDataSeeder; _dataSeeder = dataSeeder;
} }
public void Build() public void Build()
@ -21,7 +22,7 @@ namespace MyCompanyName.MyProjectName
public async Task BuildInternalAsync() public async Task BuildInternalAsync()
{ {
await _identityDataSeeder.SeedAsync("1q2w3E*"); await _dataSeeder.SeedAsync();
} }
} }
} }
Loading…
Cancel
Save