WebApiX 1.0.5

dotnet add package WebApiX --version 1.0.5
NuGet\Install-Package WebApiX -Version 1.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebApiX" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebApiX --version 1.0.5
#r "nuget: WebApiX, 1.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WebApiX as a Cake Addin
#addin nuget:?package=WebApiX&version=1.0.5

// Install WebApiX as a Cake Tool
#tool nuget:?package=WebApiX&version=1.0.5

Provides Generic Web Api Controllers to perform CRUD operations against a Sql Server, including Temporal Tables, with DTO support

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.5 573 5/5/2020
1.0.4 496 5/5/2020
1.0.3 479 5/5/2020
1.0.2 528 4/30/2020
1.0.1 511 4/29/2020
1.0.0 532 4/18/2020

// FEATURES:
This package provides CRUD capabilities (and temporal support) for generic controllers based on specific entity types.
Controllers provides those methods/calls
-   GET                     => items list
-   GET/key                 => item by key (in case of multiple keys v: POST GetItemFromBody)
-   GET GetItemsByIdList    => item list (ActionName:GetItemsByIdList)  [FromQuery(Name = "ids")] IEnumerable<TKey> ids
-   PUT [FormBody(item)]    => updates item from body
-   POST [FormBody(item)]   => creates item from body
-   POST PostItems          => creates items (ActionName:PostItems)    [FromBody] IEnumerable<T> items
-   DELETE/key              => deletes item by key (in case of multiple keys v: POST DeleteItemFromBody)
*** Magic Method ***
-   POST DoQuery            => item list from Dynamic.Linq (ActionName:DoQuery) [FromBody] QryObj   (es: QryObj.Qry = "Desc=@0", QryObj.Pars = "pluto")
NB: add package (for 'DoQuery' calls):
Install-Package System.Linq.Dynamic.Core -Version 1.1.0  

// USAGE:
// Injections (in startup.cs)
services.AddDbContext<MyContext>(options => options.UseSqlServer(cnx));
services.AddScoped<DbContext, MyContext>();  
services.AddScoped(typeof(IGenericLogic<,>), typeof(GenericLogic<,>));

// Simple Controller: manages entities of type MyEntity with a long PK column
public class MyController : GenericController<MyEntity, long>
{
   public MyController(IGenericLogic<MyEntity, long> logic) : base(logic) { }
}

// DTO Controller: manages entities of type MyEntityDto (based on MyEntity type) with multiple PK's
public class MyDtoController : GenericDtoController<MyEntityDto, MyEntity, object[]>
{
   public MyDtoController(IGenericLogic<MyEntity, object[]> logic, IMapper mapper) : base(logic, mapper) { }
}

// Logic Override (to provide custom implementation of the methods, use ObjectBrowser to inspect them)
public class MyLogic : GenericLogic<MyEntity, string>
{
   public MyLogic(MyContext context) :base(context) { }

   public async override......
}

TEMPORAL TABLE SUPPORT:
Use the DbSet extension: AddTemporalSupport to create the 'History' schema and relative temporal tables.
   -   GET GetHistoricItems    => items list in a specific period (DateTime from?, DateTime to)    
   -   GET GetHistoricItem     => items list in a specific period for a specific key (TKey id, DateTime from?, DateTime to)
*** Magic Methods ***
   -   GET GetChangedItem      => Get ONLY the CHANGED items list in a specific period (DateTime from?, DateTime to)    
   -   GET GetChangedItems     => Get ONLY the CHANGED items list in a specific period for a specific key (TKey id, DateTime from?, DateTime to
   -   GET GetDeletedItems     => Get ONLY the DELETED items list in a specific period (DateTime from?, DateTime to

SAMPLE CALLS:
[GET] /MyDtoController =>   List of DTO's
[GET] /MyController/1  =>   Item with key = 1

[GET] /MyDtoController/GetHistoricItems      =>   List of historical DTO's
[GET] /MyDtoController/GetHistoricItem?id=1  =>   List of historical DTO's with PK = 1