RestDWH 1.2023.5.14
dotnet add package RestDWH --version 1.2023.5.14
NuGet\Install-Package RestDWH -Version 1.2023.5.14
<PackageReference Include="RestDWH" Version="1.2023.5.14" />
paket add RestDWH --version 1.2023.5.14
#r "nuget: RestDWH, 1.2023.5.14"
// Install RestDWH as a Cake Addin #addin nuget:?package=RestDWH&version=1.2023.5.14 // Install RestDWH as a Cake Tool #tool nuget:?package=RestDWH&version=1.2023.5.14
Rest DWH library
The aim of this library is to provide REST CRUD endpoints for data storage
The enterprise grade level of audit data where all data are queryable and historic modifications with user information and exact timestamps.
Rest DWH library provides data governance platform for fast code first development.
Currently supported DBs:
- elasticsearch
How it works
User defines model and sets attribute RestDWHEntity. The library produces the controllers, the DB object models, and repositories.
using RestDWH.Attributes;
namespace MyApp.Model
{
[RestDWHEntity("Test")]
public class Test
{
public string Name { get; set; }
}
}
This creates Get,GetById,Put,Post,Patch and Delete operations on object Test.
Events
Coder can create custom code in events before or after the data are handled by the controller method or before are stored to the database.
For example
using MyApp.Model;
using RestDWH.Model;
using System.Security.Claims;
namespace MyApp.Events
{
public class TestEvents : RestDWHEvents<Test>
{
public override async Task<(int from, int size, string query, string sort)> BeforeGetAsync(int from = 0, int size = 10, string query = "*", string sort = "", ClaimsPrincipal? user = null)
{
return (from, size, query, sort);
}
public override async Task<DBBase<Test>> ToCreate(DBBase<Test> item, ClaimsPrincipal? user = null)
{
return item;
}
public override async Task<DBBase<Test>> AfterDeleteAsync(DBBase<Test> result, string id, ClaimsPrincipal? user = null)
{
return result;
}
}
}
To tell the RestDWH you use this events for model test, reference your event class in the attribute.
using MyApp.Events;
using RestDWH.Attributes;
namespace MyApp.Model
{
[RestDWHEntity("Test", typeof(TestEvents))]
public class Test
{
public string Name { get; set; }
}
}
Installation
using RestDWH.Extensions;
...
# use CreateAPIControllers to add generated controllers
builder.Services.AddControllers().AddNewtonsoftJson().CreateAPIControllers();
builder.Services.AddProblemDetails();
builder.Services.AddAuthentication(...)
...
# use ExtendElasticConnectionSettings to add default mapping to the db objects
var settings =
new ConnectionSettings(new Uri(".."))
.ApiKeyAuthentication(new ApiKeyAuthenticationCredentials(".."))
.ExtendElasticConnectionSettings();
...
var client = new ElasticClient(settings);
builder.Services.AddSingleton<IElasticClient>(client);
...
# use RegisterRestDWHRepositories to register repositories
builder.Services.RegisterRestDWHRepositories();
# use RegisterRestDWHEvents to register object events classes
builder.Services.RegisterRestDWHEvents();
...
# use PreloadRestDWHRepositories to preload repositories to memory
app.PreloadRestDWHRepositories();
...
app.UseAuthentication();
app.UseAuthorization();
...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.AspNetCore.Authorization (>= 7.0.5)
- Microsoft.AspNetCore.JsonPatch (>= 7.0.5)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- NEST (>= 7.17.5)
- Swashbuckle.AspNetCore.Annotations (>= 6.5.0)
- System.CodeDom (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2023.5.14 | 191 | 5/14/2023 |
1.2023.4.28 | 169 | 4/28/2023 |
1.0.2023.428 | 164 | 4/28/2023 |
1.0.0 | 167 | 4/28/2023 |