This fork adds PostSharp aspects to ASP.NET Boilerplate, replacing the Castle DynamicProxy interceptors for added performance.
In order to use this fork with PostSharp, please refer to the next section.
For anything else, refer to the original ASP.NET Boilerplate repository, and the original ASP.NET Boilerplate Documentation
First of all, you will need a PostSharp community or a PostSharp framework license, read this to learn more about their licensing program. Please note that the community license is limited to 1000 enhanced lines of code, but you can try their ultimate license for free for 45 days to verify if this solution is good for you.
Assuming that you already have a solution that uses ASP.NET Boilerplate, you will have to replace all your Abp.* package references to Emisand.Abp.PostSharp.*, this replaces all the original Abp packages with PostSharp enhanced packages.
You will also have to add a reference to the PostSharp package too all of your projects that implement IApplicationService
, IRepository
or any of their derived classes, or use any of the following attributes: AbpAuthorize
, Audited
, RequiresFeature
, UnitOfWork
or UseCase
.
If you have a .props files included at all of your solution projects, like the common.props file included in the ASP.NET Zero solution, then just add the following package reference to the props file so it looks like this:
<Project>
<ItemGroup>
<PackageReference Include="PostSharp" Version="6.9.5">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
Then, you will have to add a PostSharp configuration file named postsharp.config to the root folder of your solution (same folder as your .sln files) with the following contents, replacing YOUR_LICENSE_CODE with your own PostSharp license:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
<License Value="YOUR_LICENSE_CODE" />
<Multicast>
<AuthorizationAspectProvider xmlns="clr-namespace:Abp.Authorization;assembly:Abp" />
<AuditingAspectProvider xmlns="clr-namespace:Abp.Auditing;assembly:Abp" />
<EntityHistoryAspectProvider xmlns="clr-namespace:Abp.EntityHistory;assembly:Abp" />
<UnitOfWorkAspectProvider xmlns="clr-namespace:Abp.Domain.Uow;assembly:Abp" />
<ValidationAspectProvider xmlns="clr-namespace:Abp.Runtime.Validation.Interception;assembly:Abp" />
</Multicast>
</Project>
Finally, you have to find the AddAbp()
call in your Startup class and add a line to the options lambda like this: options.EnablePostSharp = true;
Example:
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//...
//Configure Abp and Dependency Injection. Should be called last.
return services.AddAbp<MyProjectWebModule>(options =>
{
// Enable PostSharp
options.EnablePostSharp = true;
//Configure Log4Net logging (optional)
options.IocManager.IocContainer.AddFacility<LoggingFacility>(
f => f.UseLog4Net().WithConfig("log4net.config")
);
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
//Initializes ABP framework and all modules. Should be called first.
app.UseAbp();
//...
}
}
Once all of this has been done and you rebuild your solution, PostSharp aspects will be applied to your code at compilation.
If you do not add the options.EnablePostSharp = true;
to your Startup class, then Abp will use the default Castle DynamicProxy interceptors and not use any of the implemented PostSharp aspects.
ASP.NET Boilerplate is a general purpose application framework specially designed for new modern web applications. It uses already familiar tools and implements best practices around them to provide you a SOLID development experience.
ASP.NET Boilerplate works with the latest ASP.NET Core & EF Core but also supports ASP.NET MVC 5.x & EF 6.x as well.
Designed to be modular and extensible, ABP provides the infrastructure to build your own modules, too.
SaaS applications made easy! Integrated multi-tenancy from database to UI.
Comprehensive documentation and quick start tutorials.
Don't Repeat Yourself! ASP.NET Boilerplate automates common software development tasks by convention. You focus on your business code!
See the Introduction document for more details.
ABP provides a layered architectural model based on Domain Driven Design and provides a SOLID model for your application.
See the NLayer Architecture document for more details.
This is an ASP.NET Boilerplate module integrated with Microsoft ASP.NET Identity.
Implements abstract concepts of ASP.NET Boilerplate framework:
- Setting store
- Audit log store
- Background job store
- Feature store
- Notification store
- Permission checker
Also adds common enterprise application features:
- User, Role and Permission management for applications that require authentication and authorization.
- Tenant and Edition management for SaaS applications.
- Organization Units management.
- Language and localization text management.
- Identity Server 4 integration.
Module Zero packages define entities and implement base domain logic for these concepts.
You can create your project from startup templates to easily start with Module Zero:
- ASP.NET Core & Angular based startup project.
- ASP.NET Core MVC & jQuery based startup project.
- ASP.NET Core MVC 5.x / AngularJS based startup project.
A screenshot of the ASP.NET Core based startup template:
- Web site & Documentation: https://aspnetboilerplate.com
- Questions & Answers: https://stackoverflow.com/questions/tagged/aspnetboilerplate?sort=newest
MIT.