Files
ShaoHua 734b2c91f9 build: 升级目标框架到net10.0并完善模板配置
1. 将Hua.Cli.Tests、项目共享库、模块项目等所有项目的TargetFramework从net8.0/net9.0升级到net10.0
2. 完善dotnet-tools.json、模板配置文件,添加必要的构建和发布配置
3. 新增微服务、网关、应用程序的启动脚本和基础配置文件
4. 补充产品管理模块的领域、应用、Web层基础代码和多语言资源
2026-07-16 02:43:29 +08:00

102 lines
3.9 KiB
C#

using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
using Volo.Blogging;
using Volo.Blogging.Blogs;
using Volo.Blogging.Posts;
namespace Company.Project.BloggingService;
public class BlogServiceDataSeeder : IDataSeedContributor, ITransientDependency
{
private readonly IBlogRepository _blogRepository;
private readonly IPostRepository _postRepository;
private readonly IGuidGenerator _guidGenerator;
private readonly IPermissionDataSeeder _permissionDataSeeder;
public BlogServiceDataSeeder(
IBlogRepository blogRepository,
IGuidGenerator guidGenerator,
IPostRepository postRepository,
IPermissionDataSeeder permissionDataSeeder)
{
_blogRepository = blogRepository;
_guidGenerator = guidGenerator;
_postRepository = postRepository;
_permissionDataSeeder = permissionDataSeeder;
}
[UnitOfWork]
public virtual async Task SeedAsync(DataSeedContext context)
{
await CreateBlogPostsAsync();
await GrantAdminPermissionsAsync();
}
private async Task GrantAdminPermissionsAsync()
{
await _permissionDataSeeder.SeedAsync(
RolePermissionValueProvider.ProviderName,
"admin",
BloggingPermissions.GetAll()
);
}
private async Task CreateBlogPostsAsync()
{
if (await _blogRepository.GetCountAsync() > 0)
{
return;
}
var abpBlog = await _blogRepository.InsertAsync(
new Blog(
_guidGenerator.Create(),
"ABP",
"abp"
)
);
await _postRepository.InsertAsync(
new Post(
_guidGenerator.Create(),
abpBlog.Id,
"Introduction to ABP vNext",
"/api/blogging/files/www/100d4c0445cbf55f687339ec8e656abb.jpg",
"introduction-to-abp-vnext"
)
{
Content = @"### Introduction
For a while, we were working to design a new major version of the ASP.NET Boilerplate framework. Now, it's time to share it with the community. We are too excited and we believe that you are too.
#### Naming
The name of the framework remains same, except we will call it only as ""ABP"" instead of ""ASP.NET Boilerplate"". Because, the ""boilerplate"" word leads to misunderstandings and does not reflect that it is a framework (instead of some boilerplate code). We continue to use the ""ABP"" name since it's the successor of the current ASP.NET Boilerplate framework, except it's a rewrite.
### How To Start
We have created a startup template. You can just create a new project from https://abp.io/Templates and start your development. For more information, visit [abp.io](https://abp.io).
### Why A Complete Rewrite?
When we first introduced the ABP framework, it was 2013 (5 years ago)! There was no .Net Core & ASP.NET Core and there was no Angular2+.
ASP.NET Core introduced many built-in solutions (extension libraries) for dependency injection, logging, caching, localization, configuration and so on.
We wanted to depend on these new extension libraries instead of 3rd-party and custom solutions.
#### Application Modularity
The first goal is to provide a good infrastructure to develop application modules. We think a module as a set of application features with its own database, its own entities, services, APIs, UI pages, components and so on.
#### Microservices
We are designing the new ABP framework to be ready to develop microservices and communicate them to each other.
### Communication / Links
* Official web site: [abp.io](https://abp.io)
* Github: [github.com/abpframework](https://github.com/abpframework)
* Twitter: [@abpframework](https://twitter.com/abpframework)"
}
);
}
}