https://github.com/ipjohnson/Grace.DependencyInjection.Extensions
Grace Extensions for ASP.Net Core
https://github.com/ipjohnson/Grace.DependencyInjection.Extensions
Last synced: about 1 year ago
JSON representation
Grace Extensions for ASP.Net Core
- Host: GitHub
- URL: https://github.com/ipjohnson/Grace.DependencyInjection.Extensions
- Owner: ipjohnson
- Created: 2016-06-14T23:32:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T15:00:02.000Z (over 3 years ago)
- Last Synced: 2023-04-10T11:28:29.342Z (about 3 years ago)
- Language: C#
- Homepage:
- Size: 118 KB
- Stars: 19
- Watchers: 3
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Extensions for using Grace in ASP.Net Core
Using Grace in an ASP.Net Core application is really simple, add the [Grace.AspNetCore.Hosting](https://www.nuget.org/packages/Grace.AspNetCore.Hosting) package. Then add the following to your project
Program.cs
```
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseGrace() // add grace
.UseStartup()
.Build();
```
When using with .Net Core 3.x, make sure to `UseGrace()` from the IHostBuilder, not the IWebHostBuilder:
```
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
// UseGrace() goes here
.UseGrace()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
// UseGrace() doesn't go here
.UseStartup();
});
```
Startup.cs
```
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// add this method
public void ConfigureContainer(IInjectionScope scope)
{
// add your registrations here
}
```
Grace provides custom controller and view activators providing better performance some custom features.
Add the [Grace.AspNetCore.MVC](https://www.nuget.org/packages/Grace.AspNetCore.MVC) nuget package.
Startup.cs
```
public void ConfigureContainer(IInjectionScope scope)
{
scope.SetupMvc();
// add your registrations here
}
```
Note: .net core 1.0 support will be removed in version 7.1.0
[](https://ci.appveyor.com/project/ipjohnson/grace-dependencyinjection-extensions)