@ -0,0 +1,15 @@ |
|||
Clear-Host |
|||
|
|||
Write-Host "Deleting all BIN and OBJ folders..." -ForegroundColor Cyan |
|||
|
|||
Get-ChildItem -Path . -Include bin,obj -Recurse -Directory | ForEach-Object { |
|||
if ($_.FullName -notmatch "\\node_modules\\") { |
|||
Write-Host "Deleting:" $_.FullName -ForegroundColor Yellow |
|||
Remove-Item $_.FullName -Recurse -Force |
|||
} else { |
|||
Write-Host "Skipping:" $_.FullName -ForegroundColor Magenta |
|||
} |
|||
} |
|||
|
|||
Write-Host "BIN and OBJ folders have been successfully deleted." -ForegroundColor Green |
|||
|
|||
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 788 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 173 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 79 KiB |
@ -0,0 +1,85 @@ |
|||
Building robust web applications has become more important than ever as the world is becoming more web-focused. With the rise of new tools and frameworks, choosing the right web development framework can be challenging. Especially if you are a .NET developer, there not so many popular ASPNET Framework around. However, the ABP Framework has become popular for many developers due to its flexibility, scalability, feature set and performance. Let's mention what's ABP Framework and what it promises to .NET developers. |
|||
|
|||
## ASP.NET Core Architecture Best Practices |
|||
|
|||
 |
|||
|
|||
ABP Framework is an application design framework that provides developers with a powerful set of tools to build web applications quickly and efficiently. It is an open-source, cross-platform framework supporting monolithic and microservices architectures. ABP Framework is built on top of the ASP.NET Core architecture and incorporates best practices for developing web applications. |
|||
|
|||
## ASP.NET Platform |
|||
|
|||
The framework includes a wide range of features, such as an angular code generator with the help of [ABP Suite](https://commercial.abp.io/tools/suite), project templates, and web application themes. These features enable developers to create web applications that are both functional and visually appealing without spending much time on coding. Moreover, ABP Framework provides a common application framework that can be used for different applications, including SAAS, e-commerce, and social media platforms. |
|||
|
|||
ABP Framework also supports the domain-driven design, which means that the framework is designed to be flexible and adaptable to different business requirements. This approach allows developers to build applications aligned with business needs, ensuring that they are efficient and effective. |
|||
|
|||
## Open Source Dot Net Framework |
|||
|
|||
One of the major advantages of ABP Framework is its open-source nature. Many developers continuously improve and update the framework, making it more reliable and secure. Moreover, the ABP Framework is compatible with multiple .NET frameworks, including ASP.NET and .NET Core. When starting your project on top of a solid Microsoft web framework, the ABP Framework is one of the best choices. |
|||
|
|||
 |
|||
|
|||
Another advantage of ABP Framework is that it provides rapid web application development tools that are easy to use. The framework includes project templates that developers can use as a starting point for their web applications, which can significantly reduce the development time. ABP Framework also provides a web app builder that developers can use to create web applications quickly and efficiently. |
|||
|
|||
## ASPNET Core Architecture |
|||
|
|||
ABP Framework is also compatible with Microsoft's Clean Architecture, a software design pattern that promotes separation of concerns and maintainability. This integration ensures that the applications developed using ABP Framework are well-structured, easy to maintain, and scalable. Many application marketplace reviewers commented about ABP as the best web application framework. While ABP supports multiple UI choices like MVC, Angular, Blazor Web Assembly and Blazor Server, the most downloaded one is MVC microservice architecture. If you are here to find a NET application framework for your next NET Core application, you are in the right place! |
|||
|
|||
 |
|||
|
|||
Clean Architecture is a design pattern that emphasizes the separation of concerns, ensuring that the code is organized in independent layers. This helps developers to write code that is easy to maintain, test and refactor. ABP Framework uses this pattern to structure its application code and ensure that it is easy to manage. |
|||
|
|||
## Open Source Web Framework |
|||
|
|||
ABP Framework is an open-source web framework that is free to use and distribute. The framework is licensed under the MIT license, meaning developers can use it for commercial and non-commercial purposes without any restrictions. |
|||
|
|||
ABP Framework provides different templates, which are ASPNET Core web app compatible with various platforms, including Windows, Linux, and macOS. |
|||
|
|||
## Domain Driven Design DotNet |
|||
|
|||
The ABP Framework also implements Domain-Driven Design (DDD), a software design methodology that emphasizes the importance of the domain model. The framework provides a guide for implementing DDD through an implementing domain-driven design. It helps developers to create a domain model that is easy to understand, test, and maintain. As ABP is a C# framework, it supports most of the common application framework features for a core framework. |
|||
|
|||
 |
|||
|
|||
There is also a free PDF e-book for Dotnet developers that explains the Domain Driven Design principle with real-world examples. You can download this e-book at https://abp.io/books/implementing-domain-driven-design |
|||
|
|||
## It's a Dotnet Web Framework |
|||
|
|||
ABP Framework is a dotnet web framework that is designed with C# and provides developers with a set of tools that makes it easy to build modern web applications. Whether you want to start a new dotnet monolithic solution or dotnet microservice solution, you can start with ABP. Creating your own dotnet framework architecture may be hard if you don't have many years of experience. The brain team of the ABP Framework specializes in ASP.NET framework architecture and ASP.NET application frameworks. |
|||
|
|||
 |
|||
|
|||
## Essential Features of the ABP Framework: |
|||
|
|||
ASP.NET Core modularity, ASP.NET Core modular development, ASP.NET Core localization, ASP.NET Core SaaS framework, ASP.NET Core distributed, event, bus, ASP.NET Core cross-cutting concerns, ASP.NET Core blob storing, ASP.NET Core audit logging, ASP.NET Core microservice, ASP.NET Core microservice solution, ASP.NET Core microservice example, ASP.NET Core API gateway, ASP.NET Core domain, driven, design, ASP.NET Core layered architecture, ASP.NET Core layering, ASP.NET Core clean architecture, ASP.NET Core authentication, ASP.NET Core authorization, ASP.NET Core UI theme, ASP.NET Core tag helpers, ASP.NET Core identity, ASP.NET Core, identity, server, ASP.NET Core IdentityServer, ASP.NET Core payment module, ASP.NET Core best practices, ASP.NET Core design patterns, ASP.NET Core background jobs, ASP.NET Core exception handling, ASP.NET Core, background, workers, ASP.NET Core repository, ASP.NET Core repository pattern, ASP.NET Core unit of work, ASP.NET Core domain services, ASP.NET Core Swagger, ASP.NET Core content management system, ASP.NET Core CMS module, ASP.NET Core user management, ASP.NET Core Role management, ASP.NET Core permission management |
|||
|
|||
 |
|||
|
|||
## Open Source Web Application Framework |
|||
|
|||
ABP Framework is an open-source web application development framework that is free to use and distribute. The framework is licensed under the MIT license, meaning developers can use it for commercial and non-commercial purposes without any restrictions. |
|||
|
|||
 |
|||
|
|||
## C# Web Application Framework |
|||
|
|||
ABP Framework is built using C#, which is a modern programming language that is widely used in the development of web applications. C# provides developers with features that make it easy to write clean and maintainable code. ABP Framework is a web framework designed to work with C# and provides developers with tools that make it easy to build modern web applications. |
|||
|
|||
## Key Features |
|||
|
|||
The following .NET features are available in the ABP Framework: |
|||
|
|||
.NET modular development, .NET localization, .NET multi-tenancy, .NET SaaS framework, .NET distributed event bus, .NET cross-cutting concerns, .NET,microservice, .NET microservice solution, .NET microservice example, .NET domain driven design, .NET clean architecture, .NET authentication, .NET authorization, .NET best practices, .NET design,patterns, .NET exception handling, .NET background workers, .NET unit of work, .NET domain services, .NET user management, .NET role management, .NET permission management |
|||
|
|||
 |
|||
|
|||
The following keywords best describe the ABP Framework; |
|||
|
|||
Open source backend framework, open source development framework, open source web app builder, open source web applications, open source web development, web application development framework, web application framework, web application framework software, web application infrastructure, web application open source, asp net framework, asp net open source, ASP.NET application, ASP.NET software, ASP.NET web app, ASP.NET web development, web app builder open source, web app framework, Dotnet framework, Dotnet UI framework, Dotnet web application themes. |
|||
|
|||
|
|||
|
|||
## Conclusion |
|||
|
|||
ABP Framework is a powerful and flexible web application framework that provides developers with the tools to build high-quality web applications quickly and efficiently. It is an open-source, cross-platform framework that supports multiple .NET frameworks, including ASP.NET and .NET Core. ABP Framework provides rapid web application development tools, project templates, and web application themes that enable developers to create visually appealing and functional applications in no time. |
|||
|
|||
 |
|||
@ -0,0 +1,297 @@ |
|||
# Using Dapper with the ABP Framework |
|||
|
|||
[Dapper](https://github.com/DapperLib/Dapper) is a simple and lightweight object mapper for .NET. A key feature of Dapper is its [high performance](https://github.com/DapperLib/Dapper#performance) compared to other ORMs. In this article, I will show how to use it in your ABP projects. But, we'll see when to use it first. |
|||
|
|||
### Source Code |
|||
|
|||
You can find the [full source code of the demo application here](https://github.com/abpframework/abp-samples/tree/master/Dapper). |
|||
|
|||
## When to Use Dapper? |
|||
|
|||
In the ABP Framework, we suggest to use Dapper in combination with Entity Framework Core (EF Core) for the following reasons: |
|||
|
|||
* EF Core is much easier to use (you don't need to manually write SQL queries and work with low level database objects). |
|||
* EF Core abstracts different DBMS dialects, so it will be easier to change your DBMS later. |
|||
* The EF Core's change tracking system automatically updates the changes in the database. |
|||
* EF Core is better compatible with Object Oriented Programming (OOP) practices and is more type safe to work with. So, the EF Core code is more understandable and maintainable. |
|||
|
|||
In most of your use cases, you typically work with one or a few entities and a maintainable codebase can be chosen instead of a slight performance difference. However, there may be certain places in your application where it matters: |
|||
|
|||
* You may work with a lot of entities, so you'd like to query faster (Indeed, EF Core's [AsNoTracking()](https://learn.microsoft.com/en-us/ef/core/querying/tracking) extension can help in most cases). |
|||
* You may be performing too many database operations in a single request. |
|||
* EF Core may not create an optimized SQL query and you may want to manually write it for better performance. |
|||
|
|||
For such cases, Dapper can be a good choice. You can easily write SQL queries and bind the result to your objects. |
|||
|
|||
## Creating a new ABP Solution |
|||
|
|||
To demonstrate the useage of Dapper, I've created an ABP solution. You can find the [full source code of the demo application here](https://github.com/abpframework/abp-samples/tree/master/Dapper). If you want to create the same solution from scratch, follow the steps below: |
|||
|
|||
Install the ABP CLI if you haven't installed it before: |
|||
|
|||
````bash |
|||
dotnet tool install -g Volo.Abp.Cli |
|||
```` |
|||
|
|||
Create a new solution with the ABP Framework's non-layered startup template with MVC UI and EF Core database: |
|||
|
|||
````bash |
|||
abp new DapperDemo -t app-nolayers |
|||
```` |
|||
|
|||
> The startup template and UI selection don't matter for this article. I selected these options to keep the demo solution simple. |
|||
|
|||
After creating the solution, run the following command to migrate the database (run the command in the folder of the `.csproj` file: |
|||
|
|||
````csharp |
|||
dotnet run --migrate-database |
|||
```` |
|||
|
|||
> If you've created a layered solution, then run the `DbMigrator` application inside the solution. If you have trouble by creating the solution, please refer to the [Quick Start](https://docs.abp.io/en/abp/latest/Tutorials/Todo/Single-Layer/Index) document. |
|||
|
|||
## Setting Up the Entity Framework Core Part |
|||
|
|||
We will use EF Core with Dapper, so we need to configure EF Core first. I will use the following `Book` entity as an example: |
|||
|
|||
````csharp |
|||
public class Book : AuditedAggregateRoot<Guid> |
|||
{ |
|||
public string Name { get; set; } |
|||
public DateTime PublishDate { get; set; } |
|||
public float Price { get; set; } |
|||
} |
|||
```` |
|||
|
|||
If you are using a layered solution, entities are located in the `Domain` project. For my demo solution, I just placed it in the `Entities` folder of the single-layer project: |
|||
|
|||
 |
|||
|
|||
Once I created the `Book` entity, I should add it to my `DbContext` class: |
|||
|
|||
````csharp |
|||
public class DapperDemoDbContext : AbpDbContext<DapperDemoDbContext> |
|||
{ |
|||
// 1: ADD A DBSET PROPERTY |
|||
public DbSet<Book> Books { get; set; } |
|||
|
|||
public DapperDemoDbContext(DbContextOptions<DapperDemoDbContext> options) |
|||
: base(options) |
|||
{ |
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
//...other code parts |
|||
|
|||
// 2: MAP YOUR ENTITY TO A DATABASE TABLE |
|||
builder.Entity<Book>(b => |
|||
{ |
|||
b.ToTable("Books"); |
|||
b.Property(x => x.Name).IsRequired().HasMaxLength(128); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
```` |
|||
|
|||
Now, we can add a new database migration: |
|||
|
|||
````bash |
|||
dotnet ef migrations add Added_Book |
|||
```` |
|||
|
|||
And apply the changes to the database: |
|||
|
|||
````bash |
|||
dotnet ef database update |
|||
```` |
|||
|
|||
At this point, you should be able to see the Books table if you check your database: |
|||
|
|||
 |
|||
|
|||
> As you see, the `Books` table contains more fields than the `Book` entity's property count. Other properties are inherited from the `AuditedAggregateRoot` table. You could inherit from the `BasicAggregateRoot` class if you don't want these properties. |
|||
|
|||
## Seeding the Database |
|||
|
|||
ABP's [data seeding](https://docs.abp.io/en/abp/latest/Data-Seeding) system is a great way to add some test data to the database. The following class inserts two books to the `Books` table when I migrate the database: |
|||
|
|||
````csharp |
|||
public class DapperDemoDataSeederContributor : IDataSeedContributor, ITransientDependency |
|||
{ |
|||
private readonly IRepository<Book, Guid> _bookRepository; |
|||
|
|||
public DapperDemoDataSeederContributor(IRepository<Book, Guid> bookRepository) |
|||
{ |
|||
_bookRepository = bookRepository; |
|||
} |
|||
|
|||
public async Task SeedAsync(DataSeedContext context) |
|||
{ |
|||
if (await _bookRepository.GetCountAsync() > 0) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
await _bookRepository.InsertAsync( |
|||
new Book |
|||
{ |
|||
Name = "1984", |
|||
PublishDate = new DateTime(1949, 6, 8), |
|||
Price = 19.84f |
|||
} |
|||
); |
|||
|
|||
await _bookRepository.InsertAsync( |
|||
new Book |
|||
{ |
|||
Name = "The Hitchhiker's Guide to the Galaxy", |
|||
PublishDate = new DateTime(1995, 9, 27), |
|||
Price = 42.0f |
|||
} |
|||
); |
|||
} |
|||
} |
|||
```` |
|||
|
|||
After creating the `DapperDemoDataSeederContributor` class, I can re-run the following command: |
|||
|
|||
````bash |
|||
dotnet run --migrate-database |
|||
```` |
|||
|
|||
Now, I can see the records in the database: |
|||
|
|||
 |
|||
|
|||
Now, everything is ready to try querying from the `Books` table with Dapper. |
|||
|
|||
## Using Dapper Without the Integration Package |
|||
|
|||
ABP provides an integration package for Dapper. However, I first want to demonstrate using Dapper without the integration package. |
|||
|
|||
### Installing the Dapper Package |
|||
|
|||
First, install the [Dapper](https://www.nuget.org/packages/Dapper) package to your project. You can use a command-line terminal, locate the root path of your project (`.csproj` file that you want to install it in) and run the following command: |
|||
|
|||
````bash |
|||
dotnet add package Dapper |
|||
```` |
|||
|
|||
> If your application is layered, then we suggest to add the `Dapper` package to your `EntityFrameworkCore` integration project in your solution. |
|||
|
|||
### Executing a Dapper Query |
|||
|
|||
I will query from the `Books` table, but I don't want to use the `Book` entity to map the result (because I don't need all the properties). So, I am creating a new class for the query result: |
|||
|
|||
````csharp |
|||
public class BookDataView |
|||
{ |
|||
public Guid Id { get; set; } |
|||
public string Name { get; set; } |
|||
public float Price { get; set; } |
|||
} |
|||
```` |
|||
|
|||
Now, we can use Dapper's `QueryAsync` extension method as shown below: |
|||
|
|||
````csharp |
|||
public class DemoService : ITransientDependency |
|||
{ |
|||
private readonly IRepository<Book, Guid> _bookRepository; |
|||
|
|||
public DemoService(IRepository<Book, Guid> bookRepository) |
|||
{ |
|||
_bookRepository = bookRepository; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task<List<BookDataView>> GetListAsync() |
|||
{ |
|||
var database = (await _bookRepository.GetDbContextAsync()).Database; |
|||
var dbConnection = database.GetDbConnection(); |
|||
var dbTransaction = database.CurrentTransaction?.GetDbTransaction(); |
|||
|
|||
var queryResult = await dbConnection.QueryAsync<BookDataView>( |
|||
"SELECT Id, Name, Price FROM Books", |
|||
transaction: dbTransaction |
|||
); |
|||
|
|||
return queryResult.ToList(); |
|||
} |
|||
} |
|||
```` |
|||
|
|||
Let's examine this class: |
|||
|
|||
* I've injected the ABP's standard [generic repository](https://docs.abp.io/en/abp/latest/Repositories) service into the `DemoService` constructor. |
|||
* `_bookRepository.GetDbContextAsync()` returns the underlying `DbContext` object of EF Core. We need to have the [Volo.Abp.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore) package reference to be able to access that method. If you have created a single-layer solution, the reference will already have existed. If you have created a layered solution you may need to manually add this package to the project that contains the `DemoService` class. Because the layered solution isolates the EF Core dependency from the rest of the solution. |
|||
* Dapper needs a `DbConnection` and a `DbTransaction` object (as optional) to execute a query. We are getting them over the `database` object obtained from the `DbContext`. We suggest to always pass the current `DbTransaction` object while working with Dapper. Because, if there is a database transaction on the same database connection that you execute queries on, and you don't pass the transaction object, you'll get an exception. |
|||
* Finally, we can use Dapper's `QueryAsync` extension method to execute the database query. |
|||
* Notice that the `GetListAsync` method is made as `virtual` and marked with the `UnitOfWork` attribute to enable the [Unit Of Work](https://docs.abp.io/en/abp/latest/Unit-Of-Work) for that method. It ensures the database connection is available in the body of the `GetListAsync` method. |
|||
|
|||
That's all. You can execute any Dapper operation using the `DbConnection` and `DbTransaction` objects obtained from the `_bookRepository` object. Please refer to Dapper's documentation for other operations. |
|||
|
|||
> We've obtained the `DbContext` object from a repository. However, a repository is not required to obtain a `DbContext`. Instead, you could inject the `IDbContextProvider<T>` service (`IDbContextProvider<DapperDemoDbContext>` for this demo) and call its `GetDbContextAsync` method. |
|||
|
|||
## Using the Volo.Abp.Dapper Package |
|||
|
|||
In the previous section, you saw that you don't need an ABP integration package to be able to use Dapper in your ABP applications. However, there is an integration package here: [Volo.Abp.Dapper](https://www.nuget.org/packages/Volo.Abp.Dapper). In fact, that package doesn't contain much services. It just provides a convenient base class to create Dapper based repository classes. |
|||
|
|||
### Installing the Volo.Abp.Dapper Package |
|||
|
|||
You can use the [ABP CLI](https://docs.abp.io/en/abp/latest/CLI#add-package) to easily install ABP packages to your projects. Execute the following command in the folder of the `.csproj` file that you want to install the package on: |
|||
|
|||
````bash |
|||
abp add-package Volo.Abp.Dapper |
|||
```` |
|||
|
|||
> You can check the [ABP Dapper document](https://docs.abp.io/en/abp/latest/Dapper) for alternative installation options. |
|||
|
|||
### Creating a Repository Class |
|||
|
|||
In the `DemoService` example, we used database objects out of a [repository](https://docs.abp.io/en/abp/latest/Repositories) class. If you want to implement layering to your solution and abstracting database operations, it can be better to create a repository class to execute the Dapper operations. |
|||
|
|||
Here's a repository class that executes the same database query: |
|||
|
|||
````csharp |
|||
public class BookRepository : DapperRepository<DapperDemoDbContext>, ITransientDependency |
|||
{ |
|||
public BookRepository(IDbContextProvider<DapperDemoDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<List<BookDataView>> GetListAsync() |
|||
{ |
|||
var connection = await GetDbConnectionAsync(); |
|||
var queryResult = await connection.QueryAsync<BookDataView>( |
|||
"SELECT Id, Name, Price FROM Books", |
|||
transaction: await GetDbTransactionAsync() |
|||
); |
|||
return queryResult.ToList(); |
|||
} |
|||
} |
|||
```` |
|||
|
|||
Let's examine this class: |
|||
|
|||
* It inherits from the `DapperRepository` class, which provides useful methods and properties for database operations. It also implements the `IUnitOfWorkEnabled` interface, so ABP makes the database connection (and transaction if requested) available in the method body by implementing dynamic proxies (a.k.a. interception). |
|||
* The `GetListAsync` method's been made `virtual`. That's needed to make the interception process working. It wouldn't be needed if we introduce `IBookRepository` to that class and always use it by injecting the `BookRepository` class (in this case, it will use interface proxying - however, this is too much details for the purpose of this article). |
|||
* We've used the `GetDbConnectionAsync` and `GetDbTransactionAsync` methods to obtain the current database connection and transaction (that is managed by ABP's [unit of work](https://docs.abp.io/en/abp/latest/Unit-Of-Work) system). |
|||
|
|||
You can then inject the `BookRepository` class when you want to get a list of `BookDataView` whenever it is needed. In the demo project, I used it inside the `IndexModel.cshtml.cs` to show a list of books on the page: |
|||
|
|||
 |
|||
|
|||
## Conclusion |
|||
|
|||
In this article, I've explained ABP's Dapper integration and demonstrated how you can execute Dapper operations in your applications. I suggest to use Dapper when it is really needed and adds any significant value (generally a performance gain) to your application. Otherwise, EF Core is much more convenient for most of the database operations and you will have a more maintainable codebase using EF Core. |
|||
|
|||
## Source Code |
|||
|
|||
You can find the [full source code of the demo application here](https://github.com/abpframework/abp-samples/tree/master/Dapper). |
|||
|
|||
## See Also |
|||
|
|||
* [ABP Dapper documentation](https://docs.abp.io/en/abp/latest/Dapper) |
|||
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
@ -0,0 +1,372 @@ |
|||
# Convert Create/Edit Modals to Page |
|||
In this document we will explain how to convert BookStore's Books create & edit modals to regular blazor pages. |
|||
|
|||
## Before |
|||
 |
|||
|
|||
## After |
|||
|
|||
 |
|||
|
|||
|
|||
# Books.razor Page |
|||
Books.razor page is the main page of the books management. Create & Update operations are done in this page. So we'll remove create & update operations from this page and move a separate blazor component for each operation. Each component will be a page. |
|||
|
|||
- Remove both Create & Update modals. |
|||
|
|||
 |
|||
|
|||
- Replace **NewBook** button with a link to **CreateBook** page. |
|||
|
|||
```html |
|||
<Button Color="Color.Primary" Type="ButtonType.Link" To="books/new"> |
|||
@L["NewBook"] |
|||
</Button> |
|||
``` |
|||
|
|||
- Inject `NavigationManager` to `Books.razor` page. |
|||
```csharp |
|||
@inject NavigationManager NavigationManager |
|||
``` |
|||
|
|||
- Replace **Edit** button with a link to **UpdateBook** page. |
|||
|
|||
```html |
|||
<Button Color="Color.Primary" Type="ButtonType.Link" OnClick="() => NavigateToEdit(book.Id)"> |
|||
@L["Edit"] |
|||
</Button> |
|||
``` |
|||
|
|||
```csharp |
|||
private void NavigateToEdit(Guid id) |
|||
{ |
|||
NavigationManager.NavigateTo($"books/{id}/edit"); |
|||
} |
|||
``` |
|||
|
|||
- Remove all methods in the `Books.razor` page except constructor. And add `GoToEditPage` as below: |
|||
|
|||
```csharp |
|||
protected void GoToEditPage(BookDto book) |
|||
{ |
|||
NavigationManager.NavigateTo($"books/{book.Id}"); |
|||
} |
|||
``` |
|||
|
|||
 |
|||
|
|||
- Change Edit button to a link in the table. |
|||
|
|||
```html |
|||
<EntityAction TItem="BookDto" |
|||
Text="@L["Edit"]" |
|||
Visible=HasUpdatePermission |
|||
Clicked="() => GoToEditPage(context)" /> |
|||
``` |
|||
|
|||
|
|||
# CreateBooks Page |
|||
Create new `CreateBook.razor` and `CreateBook.razor.cs` files in your project. |
|||
|
|||
- `CreateBook.razor` |
|||
|
|||
```html |
|||
@page "/books/new" |
|||
@attribute [Authorize(BookStorePermissions.Books.Create)] |
|||
@inherits BookStoreComponentBase |
|||
|
|||
@using Acme.BookStore.Books; |
|||
@using Acme.BookStore.Localization; |
|||
@using Acme.BookStore.Permissions; |
|||
@using Microsoft.Extensions.Localization; |
|||
@using Volo.Abp.AspNetCore.Components.Web; |
|||
|
|||
@inject IStringLocalizer<BookStoreResource> L |
|||
@inject AbpBlazorMessageLocalizerHelper<BookStoreResource> LH |
|||
@inject IBookAppService AppService |
|||
@inject NavigationManager NavigationManager |
|||
|
|||
<Card> |
|||
<CardHeader> |
|||
<HeadContent> |
|||
<ModalTitle>@L["NewBook"]</ModalTitle> |
|||
</HeadContent> |
|||
</CardHeader> |
|||
<CardBody> |
|||
<Validations @ref="@CreateValidationsRef" Model="@NewEntity" ValidateOnLoad="false"> |
|||
<Validation MessageLocalizer="@LH.Localize"> |
|||
<Field> |
|||
<FieldLabel>@L["Author"]</FieldLabel> |
|||
<Select TValue="Guid" @bind-SelectedValue="@NewEntity.AuthorId"> |
|||
@foreach (var author in authorList) |
|||
{ |
|||
<SelectItem TValue="Guid" Value="@author.Id"> |
|||
@author.Name |
|||
</SelectItem> |
|||
} |
|||
</Select> |
|||
</Field> |
|||
<Field> |
|||
<FieldLabel>@L["Name"]</FieldLabel> |
|||
<TextEdit @bind-Text="@NewEntity.Name"> |
|||
<Feedback> |
|||
<ValidationError /> |
|||
</Feedback> |
|||
</TextEdit> |
|||
</Field> |
|||
</Validation> |
|||
<Field> |
|||
<FieldLabel>@L["Type"]</FieldLabel> |
|||
<Select TValue="BookType" @bind-SelectedValue="@NewEntity.Type"> |
|||
@foreach (int bookTypeValue in Enum.GetValues(typeof(BookType))) |
|||
{ |
|||
<SelectItem TValue="BookType" Value="@((BookType) bookTypeValue)"> |
|||
@L[$"Enum:BookType.{bookTypeValue}"] |
|||
</SelectItem> |
|||
} |
|||
</Select> |
|||
</Field> |
|||
<Field> |
|||
<FieldLabel>@L["PublishDate"]</FieldLabel> |
|||
<DateEdit TValue="DateTime" @bind-Date="NewEntity.PublishDate" /> |
|||
</Field> |
|||
<Field> |
|||
<FieldLabel>@L["Price"]</FieldLabel> |
|||
<NumericEdit TValue="float" @bind-Value="NewEntity.Price" /> |
|||
</Field> |
|||
</Validations> |
|||
</CardBody> |
|||
<CardFooter> |
|||
<Button Color="Color.Secondary" Type="ButtonType.Link" To="books"> |
|||
@L["Cancel"] |
|||
</Button> |
|||
<Button Color="Color.Primary" |
|||
Type="@ButtonType.Submit" |
|||
PreventDefaultOnSubmit="true" |
|||
Clicked="CreateEntityAsync"> |
|||
@L["Save"] |
|||
</Button> |
|||
</CardFooter> |
|||
</Card> |
|||
``` |
|||
|
|||
- `CreateBook.razor.cs` |
|||
|
|||
```csharp |
|||
using Acme.BookStore.Books; |
|||
using Blazorise; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
|
|||
namespace Acme.BookStore.Blazor.Pages; |
|||
|
|||
public partial class CreateBook |
|||
{ |
|||
protected Validations CreateValidationsRef; |
|||
protected CreateUpdateBookDto NewEntity = new(); |
|||
IReadOnlyList<AuthorLookupDto> authorList = Array.Empty<AuthorLookupDto>(); |
|||
|
|||
protected override async Task OnInitializedAsync() |
|||
{ |
|||
await base.OnInitializedAsync(); |
|||
authorList = (await AppService.GetAuthorLookupAsync()).Items; |
|||
|
|||
if (!authorList.Any()) |
|||
{ |
|||
throw new UserFriendlyException(message: L["AnAuthorIsRequiredForCreatingBook"]); |
|||
} |
|||
|
|||
NewEntity.AuthorId = authorList.First().Id; |
|||
|
|||
if (CreateValidationsRef != null) |
|||
{ |
|||
await CreateValidationsRef.ClearAll(); |
|||
} |
|||
} |
|||
|
|||
protected virtual async Task CreateEntityAsync() |
|||
{ |
|||
try |
|||
{ |
|||
var validate = true; |
|||
if (CreateValidationsRef != null) |
|||
{ |
|||
validate = await CreateValidationsRef.ValidateAll(); |
|||
} |
|||
if (validate) |
|||
{ |
|||
await AppService.CreateAsync(NewEntity); |
|||
NavigationManager.NavigateTo("books"); |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
await HandleErrorAsync(ex); |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
# EditBooks Page |
|||
Create new `EditBook.razor` and `EditBook.razor.cs` files in your project. |
|||
|
|||
- `EditBook.razor` |
|||
|
|||
```html |
|||
@page "/books/{Id}" |
|||
@attribute [Authorize(BookStorePermissions.Books.Edit)] |
|||
@inherits BookStoreComponentBase |
|||
@using Acme.BookStore.Books; |
|||
@using Acme.BookStore.Localization; |
|||
@using Acme.BookStore.Permissions; |
|||
@using Microsoft.Extensions.Localization; |
|||
@using Volo.Abp.AspNetCore.Components.Web; |
|||
|
|||
@inject IStringLocalizer<BookStoreResource> L |
|||
@inject AbpBlazorMessageLocalizerHelper<BookStoreResource> LH |
|||
@inject IBookAppService AppService |
|||
@inject NavigationManager NavigationManager |
|||
|
|||
<Card> |
|||
<CardHeader> |
|||
<HeadContent> |
|||
<ModalTitle>@EditingEntity.Name</ModalTitle> |
|||
</HeadContent> |
|||
</CardHeader> |
|||
<CardBody> |
|||
<Validations @ref="@EditValidationsRef" Model="@EditingEntity" ValidateOnLoad="false"> |
|||
<Validation MessageLocalizer="@LH.Localize"> |
|||
<Field> |
|||
<FieldLabel>@L["Author"]</FieldLabel> |
|||
<Select TValue="Guid" @bind-SelectedValue="@EditingEntity.AuthorId"> |
|||
@foreach (var author in authorList) |
|||
{ |
|||
<SelectItem TValue="Guid" Value="@author.Id"> |
|||
@author.Name |
|||
</SelectItem> |
|||
} |
|||
</Select> |
|||
</Field> |
|||
<Field> |
|||
<FieldLabel>@L["Name"]</FieldLabel> |
|||
<TextEdit @bind-Text="@EditingEntity.Name"> |
|||
<Feedback> |
|||
<ValidationError /> |
|||
</Feedback> |
|||
</TextEdit> |
|||
</Field> |
|||
</Validation> |
|||
<Field> |
|||
<FieldLabel>@L["Type"]</FieldLabel> |
|||
<Select TValue="BookType" @bind-SelectedValue="@EditingEntity.Type"> |
|||
@foreach (int bookTypeValue in Enum.GetValues(typeof(BookType))) |
|||
{ |
|||
<SelectItem TValue="BookType" Value="@((BookType) bookTypeValue)"> |
|||
@L[$"Enum:BookType.{bookTypeValue}"] |
|||
</SelectItem> |
|||
} |
|||
</Select> |
|||
</Field> |
|||
<Field> |
|||
<FieldLabel>@L["PublishDate"]</FieldLabel> |
|||
<DateEdit TValue="DateTime" @bind-Date="EditingEntity.PublishDate" /> |
|||
</Field> |
|||
<Field> |
|||
<FieldLabel>@L["Price"]</FieldLabel> |
|||
<NumericEdit TValue="float" @bind-Value="EditingEntity.Price" /> |
|||
</Field> |
|||
</Validations> |
|||
</CardBody> |
|||
<CardFooter> |
|||
<Button Color="Color.Secondary" Type="ButtonType.Link" To="books"> |
|||
@L["Cancel"] |
|||
</Button> |
|||
<Button Color="Color.Primary" |
|||
Type="@ButtonType.Submit" |
|||
PreventDefaultOnSubmit="true" |
|||
Clicked="UpdateEntityAsync"> |
|||
@L["Save"] |
|||
</Button> |
|||
</CardFooter> |
|||
</Card> |
|||
``` |
|||
|
|||
- `EditBook.razor.cs` |
|||
|
|||
```csharp |
|||
using Acme.BookStore.Books; |
|||
using Blazorise; |
|||
using Microsoft.AspNetCore.Components; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
|
|||
namespace Acme.BookStore.Blazor.Pages; |
|||
|
|||
public partial class EditBook |
|||
{ |
|||
protected CreateUpdateBookDto EditingEntity = new(); |
|||
protected Validations EditValidationsRef; |
|||
IReadOnlyList<AuthorLookupDto> authorList = Array.Empty<AuthorLookupDto>(); |
|||
|
|||
[Parameter] |
|||
public string Id { get; set; } |
|||
|
|||
public Guid EditingEntityId { get; set; } |
|||
|
|||
protected override async Task OnInitializedAsync() |
|||
{ |
|||
await base.OnInitializedAsync(); |
|||
|
|||
// Blazor can't parse Guid as route constraint currently. |
|||
// See https://github.com/dotnet/aspnetcore/issues/19008 |
|||
EditingEntityId = Guid.Parse(Id); |
|||
|
|||
authorList = (await AppService.GetAuthorLookupAsync()).Items; |
|||
|
|||
if (!authorList.Any()) |
|||
{ |
|||
throw new UserFriendlyException(message: L["AnAuthorIsRequiredForCreatingBook"]); |
|||
} |
|||
|
|||
var entityDto = await AppService.GetAsync(EditingEntityId); |
|||
|
|||
EditingEntity = ObjectMapper.Map<BookDto,CreateUpdateBookDto>(entityDto); |
|||
|
|||
if (EditValidationsRef != null) |
|||
{ |
|||
await EditValidationsRef.ClearAll(); |
|||
} |
|||
} |
|||
|
|||
protected virtual async Task UpdateEntityAsync() |
|||
{ |
|||
try |
|||
{ |
|||
var validate = true; |
|||
if (EditValidationsRef != null) |
|||
{ |
|||
validate = await EditValidationsRef.ValidateAll(); |
|||
} |
|||
if (validate) |
|||
{ |
|||
await AppService.UpdateAsync(EditingEntityId, EditingEntity); |
|||
|
|||
NavigationManager.NavigateTo("books"); |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
await HandleErrorAsync(ex); |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
You can check the following commit for details: |
|||
https://github.com/abpframework/abp-samples/commit/aae61ad6d66ebf6191dd4dcfb4e23d30bd680a4e |
|||
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 191 KiB |
|
After Width: | Height: | Size: 314 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 57 KiB |
@ -0,0 +1,118 @@ |
|||
# ABP Framework: An Open Source Web Application Development Framework |
|||
|
|||
|
|||
|
|||
## What is ABP Framework? |
|||
|
|||
 |
|||
|
|||
ABP Framework is an open-source web application development framework that provides developers with a set of tools to build modern, scalable, and maintainable web applications. ABP Framework is also a C# web framework that is based on the ASP.NET web framework. It is one of the [most popular repository](https://github.com/abpframework/abp) for open source application framework. |
|||
|
|||
ABP Framework is a modular and extensible framework that uses the clean architecture principles and is built on top of the latest .NET technologies. The framework comes with a set of pre-built modules, including user management, role management, permission management, content management system (CMS) modules, which makes it easier for developers to create line of business applications. |
|||
|
|||
|
|||
|
|||
## Clean Architecture |
|||
|
|||
When you want to start a new scratch project, you first google for Dotnet Framework Architecture. There are some boilerplate dotnet startup templates but these are only an orchestration of some popular tools. ABP is not a template but it's a full stack open source application development framework. |
|||
|
|||
When you say "Clean Architecture ASP.NET Core", the first web development framework that comes to mind is undoubtedly the ABP Framework. It is built using clean architecture principles, which help developers build scalable and maintainable applications. Clean architecture separates the application into distinct layers, each with a clear responsibility. The dotnet architecture layers include the presentation layer, application layer, domain layer, and infrastructure layer. Each layer has a clear responsibility, which helps in separating concerns and keeping the code organized. This makes ABP Framework one of the best asp net frameworks. |
|||
|
|||
 |
|||
|
|||
## C# Web Framework for Web Development |
|||
|
|||
ABP Framework is built using C#, which is a modern programming language that is widely used in the development of web applications. C# provides developers with a set of features that make it easy to write clean and maintainable code. ABP Framework is a web framework that is designed to work with C# and provides developers with a set of tools that makes it easy to build modern web applications. If you are looking for an ASP NET Core shared framework download, then go to https://abp.io/get-started and create your project. |
|||
|
|||
 |
|||
|
|||
## Yet another ASP.NET Web Framework |
|||
|
|||
There are a few full stack AspNet Core frameworks around. Many of them are one developer projects which can be risky for you to start a long running project. ABP Framework is built on top of the latest ASP NET Core Framework, which provides developers with a set of features that makes it easy to build modern web applications. And most important part is, ABP is backed with a large group of developers and it has almost 10K stars on GitHub. ASP.NET provides developers with a set of tools that makes it easy to build web applications using a model-view-controller (MVC) architecture. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## Implementing Domain Driven Design with C# |
|||
|
|||
ABP Framework provides developers with a set of tools that make it easy to implement domain-driven design principles. The framework comes with a set of pre-built modules, including user management, role management, permission management, and content management system (CMS) modules, which makes it easier for developers to create complex applications. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## Open Source Web Application |
|||
|
|||
ABP Framework is an open-source web application development framework that is free to use and distribute. The framework is licensed under the MIT license, which means that developers can use it for commercial and non-commercial purposes without any restrictions. |
|||
|
|||
|
|||
|
|||
## .NET Application Framework with Pre-Built Modules |
|||
|
|||
ABP Framework is built using the latest .NET technologies and provides developers with a set of tools that makes it easy to build modern web applications. ABP contains several important modules of a line of business applications. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## C# Microservice Framework |
|||
|
|||
ABP Framework is a C# microservices framework that is designed to help developers build scalable and maintainable microservices. The framework is also known as .NET .net microservices framework. It provides developers with a set of tools that makes it easy to build microservices using clean architecture principles. |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## CRUD Tool Dotnet |
|||
|
|||
ABP Framework has a commercial version as well. The paid version comes with a premium support, rich themes and there's a very handy tool called [ABP Suite](https://commercial.abp.io/tools/suite) for "CRUD page generation ASP.NET". While ABP is not a low-code or no-code platform, ABP Suite provides ASP NET rapid application development. There are many ASP.NET rapid development tools but these are only tools without a framework support. If you are looking for web based rapid application development tools (also open-source), ABP is the way to go! |
|||
|
|||
 |
|||
|
|||
## Modular Development |
|||
|
|||
One of the best sides of the ABP Framework is the modular development side. It's born as a modular system. There are several open source web frameworks around but many of them lack of modularity. |
|||
|
|||
 |
|||
|
|||
Let's see the key features of the ABP Framework: |
|||
|
|||
- Multi-tenancy support |
|||
- Cross-cutting concerns implemented |
|||
- Full-stack microservice solution |
|||
- SaaS framework |
|||
- ASP.NET modular monolith |
|||
- Has an ASP.NET user management module |
|||
- Distributed events |
|||
- Layered architecture |
|||
- Free framework for website |
|||
- Several framework templates |
|||
|
|||
|
|||
|
|||
## The Essential Features of ABP |
|||
|
|||
ABP Framework is an open source SaaS framework. This crucial feature distinguishes it from other open source web development frameworks. |
|||
|
|||
 |
|||
|
|||
The following essential ASP.NET features are available in the ABP Framework: |
|||
|
|||
ASP.NET modularity, ASP.NET modular development, ASP.NET localization, ASP.NET multi-tenancy, ASP.NET SaaS, ASP.NET SaaS framework, ASP.NET distributed events, ASP.NET distributed event bus, ASP.NET cross-cutting concerns, ASP.NET blob storing, ASP.NET audit logging, ASP.NET microservice, ASP.NET microservice solution, ASP.NET microservice example, ASP.NET API gateway, ASP.NET domain driven design, ASP.NET layered architecture, ASP.NET layering, ASP.NET clean architecture, ASP.NET authentication, ASP.NET authorization, ASP.NET identity, ASP.NET identity server, ASP.NET IdentityServer, ASP.NET payment module, ASP.NET best practices, ASP.NET design patterns, ASP.NET background jobs, ASP.NET exception handling, ASP.NET background workers, ASP.NET repository, ASP.NET repository pattern, ASP.NET unit of work, ASP.NET domain services, ASP.NET swagger, ASP.NET content management system, ASP.NET user management, ASP.NET role management, ASP.NET permission management |
|||
|
|||
|
|||
|
|||
## Microservice Example: eShopOnAbp |
|||
|
|||
[eShopOnAbp](https://www.eshoponabp.com/) is a microservice example built on top ABP. It is a sample net application, similar to the Microsoft's [eShopOnContainer](https://github.com/dotnet-architecture/eShopOnContainers) project. It is a reference microservice solution built with the ABP Framework and .NET, runs on Kubernetes with Helm configuration, includes API Gateways, Angular and ASP.NET Core MVC applications with PostgreSQL and MongoDB databases. For more information, check out https://github.com/abpframework/eShopOnAbp. |
|||
|
|||
|
|||
|
|||
## Conclusion |
|||
|
|||
In conclusion, ABP Framework is an open-source web development framework that offers many features and benefits for building modern and scalable web applications. Its modular and extensible architecture, implementation of Domain-Driven Design, and compatibility with various platforms make it a popular choice for developers. Whether you're building a web application, microservices, or modular monoliths, ABP Framework has everything you need to get started. |
|||
|
|||
 |
|||
|
|||
Whether you're building a dot net website, a web app infrastructure, or a webpage framework, open source web application frameworks are a cost-effective and flexible option for web development. If you are looking for an open source web application builder which contains project framework template with web application development tools (open source), [ABP Framework](https://abp.io/) is the right choice. |
|||
@ -0,0 +1,60 @@ |
|||
# Top 10 .NET Core Libraries Every Developer Should Know |
|||
|
|||
> *Brief Summary*: |
|||
> |
|||
> This article is intended for .NET Core developers who wish to create a robust and useful.NET core application. It is a list of the most popular and widely used .NET Core libraries that have been carefully vetted. Go up the GitHub reference link for the DotNet libraries and see how many stars the .NET community has rewarded. |
|||
|
|||
|
|||
|
|||
## Best .NET libraries — Top useful libraries every .NET developers use |
|||
|
|||
.NET Core has become one of the most popular frameworks for developing modern applications. One of the reasons for its popularity is the wide range of libraries available to developers. .NET Core got new updates in its features with lesser coding, deploying high-accomplishment, and extremely scalable applications. Making the underlying architecture functions more effective and efficient without having to reinvent the wheel will free up your time to focus on more crucial tasks, including making your application stand out from the competition. |
|||
|
|||
In this article, we'll take a closer look at **The Most Popular .NET Libraries Every Developer Should Know**. As a software developer, you're likely familiar with the .NET framework and the many libraries it offers. With so many options available, it can be overwhelming to know which ones to choose for your project. This is the main reason I have compiled a list of the **Top 10 .NET Libraries That Developers Should Use** to make their development process more efficient and effective. A list of Top 10 .NET Core Libraries will let developers understand these so that they can pick appropriate libraries for their projects. |
|||
|
|||
If you're a .NET Core developer, there are **10 important .NET Core libraries** that you should be familiar with. While creating these **Essential 10 .NET Libraries Every Developer Must Know**, I used NuGet and GitHub.com popular repositories. And all the libraries listed here are also open-source. The list is filtered with only to .NET Core related libraries. Also I excluded the Microsoft .NET Core Framework libraries from this **Top 10 Unique .NET Core Libraries Developers Must Utilize**. So, without further ado, let’s get right into it: |
|||
|
|||
------ |
|||
|
|||
|
|||
|
|||
## Top 10 best libraries for .NET developers |
|||
|
|||
1. **Newtonsoft.Json:** This library is widely used for working with JSON data in .NET applications. It provides high performance and ease of use, making it a go-to solution for serialization and deserialization of JSON data. |
|||
2. **Dapper:** It is a simple and efficient ORM that offers high performance and flexibility when working with relational databases. It is easy to use and offers a fast and efficient way to interact with databases. |
|||
3. **Polly:** Polly is a library that helps handle transient errors and faults in .NET applications. It offers an easy-to-use policy-based approach to handling retries, timeouts, and circuit breakers, making it a valuable tool for building reliable applications. |
|||
4. **AutoMapper**: This .NET Core library simplifies object-to-object mapping by automatically mapping properties from one object to another. This library is especially useful in larger projects where mapping can become time-consuming and tedious. |
|||
5. **FluentValidation:** It is a library that provides a fluent API for building validation rules. It makes it easy to create complex validation logic and supports a wide range of validation scenarios, making it a valuable tool for ensuring data integrity in your applications. |
|||
6. **Serilog**: This library is a structured logging library that makes it easy to collect and analyze logs from your application. It offers flexibility and extensibility, and supports a variety of sinks for storing logs, including Elasticsearch, SQL Server, and more. |
|||
7. **Swashbuckle.AspNetCore.Swagger:** This library generates OpenAPI documentation for your ASP.NET Core Web API. It makes it easy to understand the functionality of your API and allows you to easily generate client code for your API. |
|||
8. **NLog**: It is is a free logging platform for .NET with rich log routing and management capabilities. It makes it easy to produce and manage high-quality logs for your application regardless of its size or complexity. |
|||
9. **Moq4**: It is is a popular mocking framework for .NET applications. It makes it easy to create mock objects for unit testing, reducing the need for expensive and time-consuming integration testing. |
|||
10. **StackExchange.Redis**: This is a library for working with Redis databases in .NET applications. It provides a simple and efficient way to interact with Redis, and offers high performance and scalability. |
|||
|
|||
------ |
|||
|
|||
 |
|||
|
|||
|
|||
|
|||
## Top 10 .NET Core Libraries List That Every Developer Must Know |
|||
|
|||
Here you can see them in table with the GitHub stars, GitHub release counts, recent release frequency, NuGet download counts and per day NuGet download counts: |
|||
|
|||
| GitHub URL | NuGet URL | Stars | Releases | Last release | Downloads | Download Per Day | |
|||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ----- | -------- | ------------ | --------- | ---------------- | |
|||
| [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) | [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json) | 10K | 65 | 1 month ago | 3B | 680K | |
|||
| [Dapper](https://github.com/DapperLib/Dapper) | [Dapper](https://www.nuget.org/packages/Dapper) | 16K | 70 | 2 years ago | 216M | 50K | |
|||
| [Polly](https://github.com/App-vNext/Polly) | [Polly](https://www.nuget.org/packages/polly) | 12K | 26 | 1 year ago | 335M | 92K | |
|||
| [AutoMapper](https://github.com/AutoMapper/AutoMapper) | [AutoMapper](https://www.nuget.org/packages/AutoMapper) | 9K | 41 | 6 months ago | 400M | 90K | |
|||
| [FluentValidation](https://github.com/FluentValidation/FluentValidation) | [FluentValidation](https://www.nuget.org/packages/FluentValidation) | 8K | 68 | 3 days ago | 250M | 56K | |
|||
| [Serilog](https://github.com/serilog/serilog) | [Serilog](https://www.nuget.org/packages/Serilog) | 6K | 15 | 1 month ago | 722M | 197K | |
|||
| [Swashbuckle.AspNetCore.Swagger](https://github.com/domaindrivendev/Swashbuckle.AspNetCore) | [Swashbuckle.AspNetCore.Swagger](https://www.nuget.org/packages/Swashbuckle.AspNetCore.Swagger) | 5K | 28 | 4 months ago | 386M | 168K | |
|||
| [NLog](https://github.com/NLog/NLog) | [NLog](https://www.nuget.org/packages/Nlog) | 6K | 125 | 1 week ago | 217M | 48K | |
|||
| [Moq](https://github.com/moq/moq4) | [Moq](https://www.nuget.org/packages/Moq) | 5K | 33 | 4 months ago | 418M | 93K | |
|||
| [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis) | [StackExchange.Redis](https://www.nuget.org/packages/StackExchange.Redis) | 5K | 34 | 11 days ago | 244M | 74K | |
|||
|
|||
|
|||
|
|||
In conclusion, these 10 .NET Core libraries are essential tools for any .NET Core developer. They offer a wide range of functionality, from handling errors to mocking for unit testing and simplifying object mapping. Whether you're working on a large-scale enterprise application or a small project, these libraries can help you build more reliable, efficient, and effective applications. |
|||
|
|||
|
After Width: | Height: | Size: 613 KiB |
|
After Width: | Height: | Size: 523 KiB |
|
After Width: | Height: | Size: 40 KiB |
@ -1,68 +1,69 @@ |
|||
# Dapper Integration |
|||
|
|||
Dapper is a light-weight and simple database provider. The major benefit of using Dapper is writing T-SQL queries. It provides some extension methods for `IDbConnection` interface. |
|||
[Dapper](https://github.com/DapperLib/Dapper) is a simple and lightweight object mapper for .NET. A key feature of Dapper is its [high performance](https://github.com/DapperLib/Dapper#performance) compared to other ORMs. |
|||
|
|||
ABP does not encapsulate many functions for Dapper. ABP Dapper library provides a `DapperRepository<TDbContext>` base class based on ABP EntityFrameworkCore module, which provides the `IDbConnection` and `IDbTransaction` properties required by Dapper. |
|||
While you can use Dapper as is in your ABP applications, there is also an integration package that simplifies creating repository classes using Dapper. |
|||
|
|||
`IDbConnection` and `IDbTransaction` works well with the [ABP Unit-Of-Work](Unit-Of-Work.md). |
|||
> ABP's Dapper integration package is based on Entity Framework Core (EF Core). That means it assumes you will use Dapper mixed with EF Core where EF Core is the primary database provider and you use Dapper when you need to fine-tune your quires and get the maximum performance. See [this article](https://community.abp.io/posts/using-dapper-with-the-abp-framework-shp74p2l) if you want to know why it is like that. |
|||
|
|||
## Installation |
|||
|
|||
Install and configure EF Core according to [EF Core's integrated documentation](Entity-Framework-Core.md). |
|||
You can use the [ABP CLI](CLI.md) to install the [Volo.Abp.Dapper](https://www.nuget.org/packages/Volo.Abp.Dapper) package to your project. Execute the following command in the folder of the `.csproj` file that you want to install the package on: |
|||
|
|||
`Volo.Abp.Dapper` is the main nuget package for the Dapper integration. |
|||
|
|||
You can find it on NuGet Gallery: https://www.nuget.org/packages/Volo.Abp.Dapper |
|||
|
|||
Install it to your project (for a layered application, to your data/infrastructure layer): |
|||
|
|||
```shell |
|||
Install-Package Volo.Abp.Dapper |
|||
``` |
|||
|
|||
Then add `AbpDapperModule` module dependency (with `DependsOn` attribute) to your [module](Module-Development-Basics.md): |
|||
|
|||
````C# |
|||
using Volo.Abp.Dapper; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace MyCompany.MyProject |
|||
{ |
|||
[DependsOn(typeof(AbpDapperModule))] |
|||
public class MyModule : AbpModule |
|||
{ |
|||
//... |
|||
} |
|||
} |
|||
````bash |
|||
abp add-package Volo.Abp.Dapper |
|||
```` |
|||
|
|||
## Implement Dapper Repository |
|||
> If you haven't done it yet, you first need to install the ABP CLI. For other installation options, see [the package description page](https://abp.io/package-detail/Volo.Abp.Dapper). |
|||
> |
|||
> If you have a layered solution, it is suggested to install that package to your database layer of the solution. |
|||
|
|||
The following code creates the `PersonRepository`, which requires EF Core's `DbContext` (MyAppDbContext). |
|||
You can inject `PersonDapperRepository` to your services for your database operations. |
|||
## Implement a Dapper Repository |
|||
|
|||
`DbConnection` and `DbTransaction` comes from the `DapperRepository` base class. |
|||
The best way to interact with Dapper is to create a [repository](Repositories.md) class that abstracts your Dapper database operations. The following example creates a new repository class that works with the `People` table: |
|||
|
|||
```C# |
|||
public class PersonDapperRepository : DapperRepository<MyAppDbContext>, ITransientDependency |
|||
public class PersonDapperRepository : |
|||
DapperRepository<MyAppDbContext>, ITransientDependency |
|||
{ |
|||
public PersonDapperRepository(IDbContextProvider<MyAppDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<List<string>> GetAllPersonNames() |
|||
public virtual async Task<List<string>> GetAllPersonNamesAsync() |
|||
{ |
|||
var dbConnection = await GetDbConnectionAsync(); |
|||
return (await dbConnection.QueryAsync<string>("select Name from People", transaction: await GetDbTransactionAsync())) |
|||
.ToList(); |
|||
return (await dbConnection.QueryAsync<string>( |
|||
"select Name from People", |
|||
transaction: await GetDbTransactionAsync()) |
|||
).ToList(); |
|||
} |
|||
|
|||
public virtual async Task<int> UpdatePersonNames(string name) |
|||
public virtual async Task<int> UpdatePersonNamesAsync(string name) |
|||
{ |
|||
var dbConnection = await GetDbConnectionAsync(); |
|||
return await dbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, |
|||
await GetDbTransactionAsync()); |
|||
return await dbConnection.ExecuteAsync( |
|||
"update People set Name = @NewName", |
|||
new { NewName = name }, |
|||
await GetDbTransactionAsync() |
|||
); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
Let's examine this class: |
|||
|
|||
- It inherits from the `DapperRepository` class, which provides useful methods and properties for database operations. It also implements the `IUnitOfWorkEnabled` interface, so ABP makes the database connection (and transaction if requested) available in the method body by implementing dynamic proxies (a.k.a. interception). |
|||
- It gets an `IDbContextProvider<MyAppDbContext>` object where `MyAppDbContext` is type of your Entity Framework Core `DbContext` class. It should be configured as explained in the [EF Core document](Entity-Framework-Core.md). If you've created by ABP's startup template, then it should already be configured. |
|||
- The `GetAllPersonNamesAsync` and `UpdatePersonNamesAsync` method's been made `virtual`. That's needed to make the interception process working. |
|||
- We've used the `GetDbConnectionAsync` and `GetDbTransactionAsync` methods to obtain the current database connection and transaction (that is managed by ABP's [Unit of Work](Unit-Of-Work.md) system). |
|||
|
|||
Then you can [inject](Dependency-Injection.md) `PersonDapperRepository` to any service to perform these database operations. If you want to implement a layered solution, we suggest to introduce an `IPersonDapperRepository` interface in your domain layer, implement it in your database later, then inject the interface to use the repository service. |
|||
|
|||
> If you want to learn more details and examples of using Dapper with the ABP Framework, [check this community article](https://community.abp.io/posts/using-dapper-with-the-abp-framework-shp74p2l). |
|||
|
|||
## See Also |
|||
|
|||
* [Community Article: Using Dapper with the ABP Framework](https://community.abp.io/posts/using-dapper-with-the-abp-framework-shp74p2l) |
|||
* [Entity Framework Core integration document](Entity-Framework-Core.md) |
|||
|
|||
@ -0,0 +1,13 @@ |
|||
# ABP Version 7.2 Migration Guide |
|||
|
|||
This document is a guide for upgrading ABP v7.1 solutions to ABP v7.2. There are a few changes in this version that may affect your applications, please read it carefully and apply the necessary changes to your application. |
|||
|
|||
## `LastPasswordChangeTime` and `ShouldChangePasswordOnNextLogin` Properties Added to the `IdentityUser` Class |
|||
|
|||
In this version, two new properties, which are `LastPasswordChangeTime` and `ShouldChangePasswordOnNextLogin` have been added to the `IdentityUser` class and to the corresponding entity. Therefore, you may need to create a new migration and apply it to your database. |
|||
|
|||
## Renamed `OnRegistered` Method |
|||
|
|||
There was a typo in an extension method, named as `OnRegistred`. In this version, we have fixed the typo and renamed the method as `OnRegistered`. Also, we have updated the related places in our modules that use this method. |
|||
|
|||
However, if you have used this method in your projects, you need to rename it as `OnRegistered` in your code. |
|||
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 202 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 10 KiB |