RestDWH.Base
2.2024.4.26
See the version list below for details.
dotnet add package RestDWH.Base --version 2.2024.4.26
NuGet\Install-Package RestDWH.Base -Version 2.2024.4.26
<PackageReference Include="RestDWH.Base" Version="2.2024.4.26" />
paket add RestDWH.Base --version 2.2024.4.26
#r "nuget: RestDWH.Base, 2.2024.4.26"
// Install RestDWH.Base as a Cake Addin #addin nuget:?package=RestDWH.Base&version=2.2024.4.26 // Install RestDWH.Base as a Cake Tool #tool nuget:?package=RestDWH.Base&version=2.2024.4.26
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.Base.Extensions;
...
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 and events
builder.Services.AddSingleton<IDWHRepository<Model.Test>, RestDWHElasticSearchRepository<Model.Test>>();
builder.Services.AddSingleton<RestDWHEvents<Model.Test>>();
...
app.UseAuthentication();
app.UseAuthorization();
...
var service = app.Services.GetService<IDWHRepository<Model.Test>>();
app.MapEndpoints<Model.Test>(service);
...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.AspNetCore.Authorization (>= 8.0.4)
- Microsoft.AspNetCore.JsonPatch (>= 8.0.4)
- Microsoft.AspNetCore.OpenApi (>= 8.0.4)
- Swashbuckle.AspNetCore (>= 6.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RestDWH.Base:
Package | Downloads |
---|---|
RestDWH.ElasticSearch
Data governance platform for fast code first development. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.2024.6.5 | 140 | 6/5/2024 |
2.2024.4.27 | 137 | 4/26/2024 |
2.2024.4.26 | 116 | 4/26/2024 |
2.2024.4.24 | 124 | 4/24/2024 |
2.2024.4.11 | 113 | 4/11/2024 |
2.2023.10.29 | 281 | 10/29/2023 |
2.2023.9.22 | 159 | 9/22/2023 |
2.2023.9.21 | 138 | 9/21/2023 |
2.2023.9.10 | 148 | 9/10/2023 |
2.2023.8.30 | 157 | 8/29/2023 |
2.2023.8.29 | 150 | 8/29/2023 |
2.2023.8.27 | 157 | 8/27/2023 |
2.2023.8.26 | 151 | 8/26/2023 |
2.2023.8.24 | 159 | 8/24/2023 |