AdaloExtensionPack.Core
0.2.15
See the version list below for details.
dotnet add package AdaloExtensionPack.Core --version 0.2.15
NuGet\Install-Package AdaloExtensionPack.Core -Version 0.2.15
<PackageReference Include="AdaloExtensionPack.Core" Version="0.2.15" />
paket add AdaloExtensionPack.Core --version 0.2.15
#r "nuget: AdaloExtensionPack.Core, 0.2.15"
// Install AdaloExtensionPack.Core as a Cake Addin #addin nuget:?package=AdaloExtensionPack.Core&version=0.2.15 // Install AdaloExtensionPack.Core as a Cake Tool #tool nuget:?package=AdaloExtensionPack.Core&version=0.2.15
AdaloExtensionPack
Helpers to connect C# Web app to Adalo tables API
Usage
Tables
In the Startup.cs file add in the method ConfigureServices() :
services.AddAdalo(x =>
{
x.AddApplication("[your Adalo App Id]", "[your API token here]")
.AddTable<SomeEntity>("[table Id]", cached: false)
.AddTable<SomeEntity>("[table Id 2]", cached: false);
});
Then inject IAdaloTableService<SomeEntity>
in your controller/services to connect directly to Adalo tables API,
or IAdaloTableCacheService<SomeEntity>
to add a cache layer between Adalo and your app.
Note: SomeEntity need to inherit from
AdaloExtensionPack.Core.Adalo.AdaloEntity
Cached tables
If the cached
parameter is set to the true
value in the call to AddTable
, a cached table service and a controller with methods to create,
read, update and delete this type of entity will be generated:
The generated controller can be used as external collection in Adalo in replacement of the original table to improve performances. In this case all the write operations must be done on the table controller to ensure the cache is always up-to-date.
Additionally, the entity list endpoint (GET /tables/some-entities) support OData syntax to select, filter, order and take elements. You can read more on this syntax here.
You can access theses cached tables from your client code using this service interface: IAdaloTableCacheService<SomeEntity>
Views
Views are filtered and mapped collections available through a controller GET action.
They are more easily usable from an Adalo perspective compare to filtered Get All cache API endpoint, since they do not require knowledge of OData query syntax. Also, the views are more flexible since other mapping possibilities and aggregations can be made thanks to mapping function.
You can create a view by adding this code inside the AddAdalo()
call:
x => x.AddApplication("[your Adalo App Id]", "[your API token here]")
.AddView<SomeContext, SomeEntity, SomeProjection>(
// Build a context which be reused in predicate and mapping.
// This can be a service or a shared state for example.
serviceProvider => serviceProvider.GetRequiredService<SomeContext>(),
(ctx, entity) => entity.IsValid, // Predicate example
(ctx, entity) => new SomeProjection(entity)); // Mapping
This will generate this method:
Security
To secure the generated controllers tables and views, it is possible to require an API Key to request these endpoints.
You can do so by adding a call to WithTableCacheControllerApiKey()
method:
builder.Services.AddAdalo(opts => /* ... */)
.WithTableCacheControllerApiKey("[api-key]");
// Or
builder.Services.AddAdalo(opts => /* ... */)
.WithTableCacheControllerApiKey(x => {
x.ApiKey = "api-key";
x.ApiKeyHeaderName = "X-Api-Key";
});
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
- CaseExtensions (>= 1.1.0)
- Humanizer.Core (>= 2.14.1)
- Microsoft.AspNetCore.OData (>= 8.2.5)
- SkiaSharp (>= 2.88.8)
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 |
---|---|---|
0.2.17 | 69 | 8/4/2024 |
0.2.16 | 105 | 5/24/2024 |
0.2.15 | 104 | 5/20/2024 |
0.2.14 | 94 | 5/20/2024 |
0.2.12 | 81 | 5/16/2024 |
0.2.11 | 84 | 5/16/2024 |
0.2.10 | 99 | 5/14/2024 |
0.2.9 | 73 | 5/14/2024 |
0.2.8 | 83 | 5/14/2024 |
0.2.7 | 86 | 5/14/2024 |
0.2.6 | 88 | 5/14/2024 |
0.2.5 | 89 | 5/13/2024 |
0.2.4 | 90 | 5/13/2024 |
0.2.3 | 91 | 5/13/2024 |
0.2.2 | 89 | 5/13/2024 |
0.2.1 | 65 | 5/13/2024 |
0.2.0 | 75 | 5/13/2024 |
0.1.1 | 350 | 4/9/2021 |
0.1.0 | 271 | 4/9/2021 |