# Luticate2 API Utils
## Getting started
NuGet.Config
```xml
```
project.json
```json
{
...
dependencies": {
"Luticate2.Utils": "0.6.*",
...
}
...
}
```
appsettings.json
```json
{
...
"ConnectionStrings": {
"default": "User ID=POSTGRES_USER;Password=POSTGRES_PASSWORD;Host=POSTGRES_HOST;Port=5432;Database=POSTGRES_DB;Pooling=true;",
...
}
...
}
```
Startup.cs
```C#
public void ConfigureServices(IServiceCollection services)
{
// ...
// MUST be before addMvc()
services.AddLuticateUtils(options => options.Version = "dev");
// ...
//The data access classes using YourDbContext need to be added as scoped
services.AddDbContext(options => // Replace YourDbContext with your own database context
{
options.UseNpgsql(Configuration.GetConnectionString("default"));
options.UseInternalServiceProvider(new ServiceCollection()
.AddEntityFrameworkNpgsqlLuticate() // MUST be before AddEntityFrameworkNpgsql()
.AddEntityFrameworkNpgsql()
.BuildServiceProvider());
}, ServiceLifetime.Transient);
services.AddMvc()
.AddLuticateUtils();
// ...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
// ...
// MUST be before useMvc()
app.UseLuticateUtils();
// ...
}
```
## Usage
See `WebApiUtils` project for an example and [starter-angular-material](https://git.rthoni.com/robin.thoni/starter-angular-material) for a frontend.
## NuGet Deployment
* Set version in csproj
* Build package:
`dotnet pack --configuration Release`
* Deploy package:
`nuget push -Source http://nuget.rthoni.com bin/Release/Luticate2.Utils.VERSION.nupkg`