magic.library
17.1.7
See the version list below for details.
dotnet add package magic.library --version 17.1.7
NuGet\Install-Package magic.library -Version 17.1.7
<PackageReference Include="magic.library" Version="17.1.7" />
paket add magic.library --version 17.1.7
#r "nuget: magic.library, 17.1.7"
// Install magic.library as a Cake Addin #addin nuget:?package=magic.library&version=17.1.7 // Install magic.library as a Cake Tool #tool nuget:?package=magic.library&version=17.1.7
magic.library - Tying Magic together
This project helps you to wire up everything related to Magic. Normally you'd use it simply like the following from your startup class in your .Net 8 Web API project.
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using magic.library;
namespace magic.backend
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
// Initializing Magic.
services.AddMagic(Configuration);
}
public void Configure(IApplicationBuilder app)
{
// Initializing Magic.
app.UseMagic(Configuration);
}
}
}
However, you can also take more control over how things are actually wired up, by instead of using the
"do all methods" called AddMagic
and UseMagic
, invoke some of the specialized initialization methods,
you can find below.
IServiceCollection.AddMagicCaching
IServiceCollection.AddMagicHttp
IServiceCollection.AddMagicLogging
IServiceCollection.AddMagicSignals
IServiceCollection.AddMagicExceptions
IServiceCollection.AddMagicEndpoints
IServiceCollection.AddMagicAuthorization
IServiceCollection.AddMagicFileServices
IServiceCollection.AddMagicFileServices
IServiceCollection.AddMagicConfiguration
IServiceCollection.AddMagicScheduler
IServiceCollection.AddMagicMail
IServiceCollection.AddMagicLambda
IServiceCollection.AddMagicSockets
The above methods is basically what the AddMagic
method actually does, and they're extension methods of
IServiceCollection
, that can be found in the magic.library
namespace. Similar alternatives to UseMagic
can
be found below.
IApplicationBuilder.UseMagicExceptions
IApplicationBuilder.UseMagicStartupFiles
IApplicationBuilder.UseMagicScheduler
IApplicationBuilder.UseMagicCors
If you use these methods instead of the "do all methods", your motivation would probably
be to replace one of these methods with your own implementation, to exchange the default wiring, by (for instance)
using a "virtual database based file system" by creating your own service implementation of for instance IFileService
from "magic.lambda.io", or use a different logging provider than the default, etc. If you wish
to do this, you'd probably benefit from looking at what the default implementation of your method does, to understand the
requirements from your method. Doing this is very powerful, and allows you to change the way the system behaves by default -
But is also definitely considered an "advanced exercise".
Exceptions handlers
Magic allows you to provide a custom exceptions handler on a per folder level. This overrides the default exception logic with a custom exception handler expected to be named "exceptions.hl" and found within the folder hierarchy where an HTTP invocation is resolved. For instance, if you wish to create your own exception handler for a specific module called "foo", you can create an exception handler file called "/files/modules/foo/exceptions.hl", and expect this file to be invoked every time an unhandled exception occurs, anywhere inside of your "foo" folder. This allows you to transform an unhandled exception, such as for instance localising it or customising it in any ways. Your custom exception handler will be invoked with the following arguments.
- [message] - The exception error message
- [path] - The URL that triggered the exception
- [field] - If the exception that was thrown declared a field, this argument will contain the name of the field
- [status] - If the exception that was thrown declared a status code, this argument will contain the status code
- [public] - If the exception that was thrown wants to propagate to the client this will be true
You can return a "transformed" exception from your exception handler, returning the following arguments, that will end up becoming the response object returned to the client.
- [message] - Message to return as JSON to client
- [field] - Field to return as JSON to client
- [status] - Status code to decorate your HTTP response with
The default exception handler can be found in "/files/exceptions.hl", which will be invoked if no custom exception handler is declared further down in your folder hierarchy.
Project website for magic.lambda.library
The source code for this repository can be found at github.com/polterguy/magic.library, and you can provide feedback, provide bug reports, etc at the same place.
Copyright and maintenance
The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.
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
- magic.endpoint (>= 17.1.7)
- magic.endpoint.services (>= 17.1.7)
- magic.lambda (>= 17.1.7)
- magic.lambda.auth (>= 17.1.7)
- magic.lambda.caching (>= 17.1.7)
- magic.lambda.config (>= 17.1.7)
- magic.lambda.crypto (>= 17.1.7)
- magic.lambda.csv (>= 17.1.7)
- magic.lambda.dates (>= 17.1.7)
- magic.lambda.guid (>= 17.1.7)
- magic.lambda.html (>= 17.1.7)
- magic.lambda.http (>= 17.1.7)
- magic.lambda.hyperlambda (>= 17.1.7)
- magic.lambda.image (>= 17.1.7)
- magic.lambda.io (>= 17.1.7)
- magic.lambda.json (>= 17.1.7)
- magic.lambda.logging (>= 17.1.7)
- magic.lambda.mail (>= 17.1.7)
- magic.lambda.math (>= 17.1.7)
- magic.lambda.mime (>= 17.1.7)
- magic.lambda.mssql (>= 17.1.7)
- magic.lambda.mysql (>= 17.1.7)
- magic.lambda.odbc (>= 17.1.7)
- magic.lambda.openai (>= 17.1.7)
- magic.lambda.pdf (>= 17.1.7)
- magic.lambda.pgsql (>= 17.1.7)
- magic.lambda.scheduler (>= 17.1.7)
- magic.lambda.slots (>= 17.1.7)
- magic.lambda.sockets (>= 17.1.7)
- magic.lambda.sqlite (>= 17.1.7)
- magic.lambda.strings (>= 17.1.7)
- magic.lambda.threading (>= 17.1.7)
- magic.lambda.validators (>= 17.1.7)
- magic.lambda.xml (>= 17.1.7)
- magic.signals (>= 17.1.7)
- Microsoft.AspNetCore.Diagnostics (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.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 |
---|---|---|
17.3.9 | 252 | 2/17/2024 |
17.3.7 | 147 | 2/12/2024 |
17.3.6 | 117 | 2/12/2024 |
17.3.5 | 107 | 2/10/2024 |
17.3.4 | 105 | 2/9/2024 |
17.3.3 | 107 | 2/8/2024 |
17.3.2 | 119 | 2/2/2024 |
17.3.1 | 122 | 1/30/2024 |
17.2.2 | 94 | 1/30/2024 |
17.2.1 | 135 | 1/22/2024 |
17.2.0 | 110 | 1/22/2024 |
17.1.7 | 177 | 1/12/2024 |
17.1.6 | 145 | 1/11/2024 |
17.1.5 | 152 | 1/5/2024 |
17.0.1 | 209 | 1/1/2024 |
17.0.0 | 338 | 12/14/2023 |
16.11.6 | 239 | 11/14/2023 |
16.11.5 | 181 | 11/12/2023 |
16.9.0 | 299 | 10/9/2023 |
16.8.5 | 183 | 9/30/2023 |
16.8.4 | 176 | 9/25/2023 |
16.8.0 | 146 | 9/24/2023 |
16.7.51 | 140 | 9/24/2023 |
16.7.50 | 152 | 9/23/2023 |
16.7.1 | 198 | 9/4/2023 |
16.7.0 | 307 | 7/11/2023 |
16.6.13 | 197 | 7/6/2023 |
16.6.12 | 194 | 7/5/2023 |
16.6.11 | 182 | 7/5/2023 |
16.6.5 | 220 | 7/3/2023 |
16.4.4 | 220 | 7/2/2023 |
16.4.3 | 229 | 6/27/2023 |
16.4.2 | 221 | 6/25/2023 |
16.4.1 | 221 | 6/25/2023 |
16.4.0 | 207 | 6/22/2023 |
16.3.2 | 298 | 6/7/2023 |
16.3.0 | 306 | 5/28/2023 |
16.2.0 | 386 | 5/13/2023 |
16.1.10 | 366 | 5/1/2023 |
16.1.9 | 285 | 4/30/2023 |
16.1.1 | 306 | 4/20/2023 |
15.10.11 | 328 | 4/16/2023 |
15.9.40 | 361 | 4/3/2023 |
15.9.1 | 417 | 3/27/2023 |
15.9.0 | 422 | 3/24/2023 |
15.8.2 | 462 | 3/20/2023 |
15.7.0 | 344 | 3/6/2023 |
15.5.20 | 712 | 2/23/2023 |
15.5.13 | 513 | 2/13/2023 |
15.5.9 | 406 | 2/11/2023 |
15.5.2 | 487 | 2/5/2023 |
15.5.1 | 401 | 2/3/2023 |
15.5.0 | 476 | 1/28/2023 |
15.2.0 | 620 | 1/18/2023 |
15.1.0 | 1,088 | 12/28/2022 |
14.5.7 | 628 | 12/13/2022 |
14.5.5 | 729 | 12/6/2022 |
14.5.1 | 563 | 11/23/2022 |
14.5.0 | 509 | 11/18/2022 |
14.4.5 | 585 | 10/22/2022 |
14.4.2 | 513 | 10/22/2022 |
14.4.1 | 518 | 10/22/2022 |
14.4.0 | 551 | 10/17/2022 |
14.3.9 | 571 | 10/13/2022 |
14.3.6 | 574 | 10/7/2022 |
14.3.2 | 583 | 9/18/2022 |
14.3.1 | 663 | 9/12/2022 |
14.3.0 | 556 | 9/10/2022 |
14.1.3 | 818 | 8/7/2022 |
14.1.2 | 568 | 8/7/2022 |
14.1.1 | 576 | 8/7/2022 |
14.0.14 | 568 | 7/26/2022 |
14.0.12 | 558 | 7/24/2022 |
14.0.11 | 534 | 7/23/2022 |
14.0.10 | 553 | 7/23/2022 |
14.0.9 | 536 | 7/23/2022 |
14.0.8 | 624 | 7/17/2022 |
14.0.5 | 692 | 7/11/2022 |
14.0.4 | 626 | 7/7/2022 |
14.0.3 | 618 | 7/2/2022 |
14.0.2 | 563 | 7/2/2022 |
14.0.1 | 608 | 7/2/2022 |
14.0.0 | 588 | 6/25/2022 |
13.4.28 | 580 | 6/11/2022 |
13.4.25 | 692 | 6/9/2022 |
13.4.24 | 582 | 6/9/2022 |
13.4.19 | 634 | 6/8/2022 |
13.4.3 | 610 | 6/6/2022 |
13.4.2 | 647 | 6/4/2022 |
13.4.0 | 667 | 5/31/2022 |
13.3.8 | 641 | 5/19/2022 |
13.3.7 | 600 | 5/18/2022 |
13.3.6 | 643 | 5/14/2022 |
13.3.4 | 717 | 5/9/2022 |
13.3.1 | 652 | 5/1/2022 |
13.3.0 | 612 | 5/1/2022 |
13.2.2 | 668 | 4/25/2022 |
13.2.1 | 625 | 4/25/2022 |
13.2.0 | 654 | 4/21/2022 |
13.1.1 | 673 | 4/20/2022 |
13.1.0 | 748 | 4/7/2022 |
13.0.0 | 684 | 4/5/2022 |
12.0.3 | 847 | 3/14/2022 |
11.0.7 | 724 | 3/11/2022 |
11.0.5 | 778 | 3/2/2022 |
11.0.4 | 699 | 2/22/2022 |
11.0.3 | 700 | 2/9/2022 |
11.0.2 | 755 | 2/6/2022 |
11.0.1 | 747 | 2/5/2022 |
10.0.21 | 713 | 1/28/2022 |
10.0.20 | 731 | 1/27/2022 |
10.0.19 | 713 | 1/23/2022 |
10.0.18 | 682 | 1/17/2022 |
10.0.17 | 695 | 1/14/2022 |
10.0.16 | 547 | 1/2/2022 |
10.0.15 | 604 | 12/31/2021 |
10.0.14 | 616 | 12/28/2021 |
10.0.13 | 686 | 12/23/2021 |
10.0.11 | 477 | 12/23/2021 |
10.0.10 | 496 | 12/22/2021 |
10.0.9 | 654 | 12/22/2021 |
10.0.8 | 541 | 12/22/2021 |
10.0.7 | 697 | 12/22/2021 |
10.0.6 | 580 | 12/19/2021 |
10.0.5 | 675 | 12/18/2021 |
10.0.3 | 459 | 12/16/2021 |
10.0.2 | 538 | 12/14/2021 |
10.0.1 | 430 | 12/13/2021 |
10.0.0 | 475 | 12/6/2021 |
9.9.9 | 1,261 | 11/29/2021 |
9.9.6 | 4,730 | 11/24/2021 |
9.9.5 | 479 | 11/23/2021 |
9.9.4 | 777 | 11/21/2021 |
9.9.3 | 548 | 11/9/2021 |
9.9.2 | 566 | 11/4/2021 |
9.9.0 | 666 | 10/30/2021 |
9.8.9 | 687 | 10/29/2021 |
9.8.7 | 575 | 10/27/2021 |
9.8.6 | 583 | 10/27/2021 |
9.8.5 | 675 | 10/26/2021 |
9.8.4 | 648 | 10/25/2021 |
9.8.3 | 701 | 10/24/2021 |
9.8.1 | 572 | 10/21/2021 |
9.8.0 | 647 | 10/20/2021 |
9.7.9 | 561 | 10/20/2021 |
9.7.8 | 594 | 10/19/2021 |
9.7.7 | 828 | 10/17/2021 |
9.7.6 | 724 | 10/17/2021 |
9.7.5 | 599 | 10/14/2021 |
9.7.1 | 537 | 10/14/2021 |
9.7.0 | 613 | 10/9/2021 |
9.6.8 | 623 | 8/30/2021 |
9.6.7 | 600 | 8/26/2021 |
9.6.6 | 712 | 8/14/2021 |
9.6.5 | 816 | 8/11/2021 |
9.6.4 | 611 | 8/10/2021 |
9.6.3 | 601 | 8/9/2021 |
9.6.2 | 600 | 8/8/2021 |
9.6.1 | 558 | 8/8/2021 |
9.5.9 | 755 | 8/5/2021 |
9.5.8 | 751 | 8/4/2021 |
9.5.3 | 636 | 7/20/2021 |
9.5.0 | 1,002 | 7/9/2021 |
9.4.5 | 611 | 6/29/2021 |
9.4.4 | 759 | 6/29/2021 |
9.4.0 | 602 | 6/24/2021 |
9.3.7 | 610 | 6/21/2021 |
9.3.6 | 662 | 6/21/2021 |
9.3.5 | 790 | 6/18/2021 |
9.3.4 | 720 | 6/18/2021 |
9.2.5 | 769 | 6/7/2021 |
9.2.4 | 707 | 6/6/2021 |
9.2.3 | 643 | 6/6/2021 |
9.2.2 | 552 | 6/4/2021 |
9.2.1 | 787 | 6/1/2021 |
9.2.0 | 745 | 5/26/2021 |
9.1.9 | 560 | 5/5/2021 |
9.1.8 | 713 | 5/5/2021 |
9.1.7 | 570 | 5/3/2021 |
9.1.4 | 579 | 4/21/2021 |
9.1.2 | 565 | 4/18/2021 |
9.1.1 | 550 | 4/15/2021 |
9.1.0 | 604 | 4/14/2021 |
9.0.1 | 670 | 4/12/2021 |
9.0.0 | 567 | 4/5/2021 |
8.9.92 | 1,140 | 3/30/2021 |
8.9.4 | 1,152 | 3/26/2021 |
8.9.3 | 1,194 | 3/19/2021 |
8.9.2 | 1,175 | 1/29/2021 |
8.9.1 | 1,240 | 1/24/2021 |
8.9.0 | 1,306 | 1/22/2021 |
8.7.1 | 1,609 | 11/15/2020 |
8.7.0 | 1,312 | 11/15/2020 |
8.6.9 | 1,249 | 11/8/2020 |
8.6.7 | 1,221 | 11/4/2020 |
8.6.6 | 1,306 | 11/2/2020 |
8.6.5 | 1,286 | 11/1/2020 |
8.6.3 | 1,307 | 10/30/2020 |
8.6.2 | 1,211 | 10/30/2020 |
8.6.1 | 1,302 | 10/29/2020 |
8.6.0 | 1,261 | 10/28/2020 |
8.5.1 | 1,251 | 10/26/2020 |
8.5.0 | 1,200 | 10/23/2020 |
8.4.6 | 1,419 | 10/20/2020 |
8.4.5 | 1,302 | 10/18/2020 |
8.4.4 | 1,323 | 10/17/2020 |
8.4.3 | 1,290 | 10/16/2020 |
8.4.2 | 1,239 | 10/16/2020 |
8.4.1 | 1,237 | 10/15/2020 |
8.4.0 | 1,314 | 10/13/2020 |
8.3.3 | 1,238 | 10/11/2020 |
8.3.2 | 1,281 | 10/8/2020 |
8.3.1 | 1,298 | 10/5/2020 |
8.3.0 | 1,250 | 10/3/2020 |
8.2.3 | 1,207 | 10/1/2020 |
8.2.2 | 1,487 | 9/26/2020 |
8.2.1 | 1,347 | 9/25/2020 |
8.2.0 | 1,381 | 9/25/2020 |
8.1.25 | 1,277 | 9/24/2020 |
8.1.24 | 1,270 | 9/23/2020 |
8.1.23 | 1,198 | 9/23/2020 |
8.1.22 | 1,269 | 9/21/2020 |
8.1.21 | 1,322 | 9/15/2020 |
8.1.20 | 1,331 | 9/14/2020 |
8.1.19 | 1,308 | 9/13/2020 |
8.1.18 | 1,276 | 9/13/2020 |
8.1.17 | 1,326 | 9/13/2020 |
8.1.16 | 1,325 | 9/13/2020 |
8.1.15 | 1,250 | 9/12/2020 |
8.1.13 | 1,145 | 9/11/2020 |
8.1.12 | 1,269 | 9/11/2020 |
8.1.11 | 1,272 | 9/11/2020 |
8.1.10 | 1,317 | 9/6/2020 |
8.1.9 | 1,315 | 9/3/2020 |
8.1.8 | 1,339 | 9/2/2020 |
8.1.7 | 1,207 | 8/28/2020 |
8.1.4 | 1,208 | 8/25/2020 |
8.1.3 | 1,381 | 8/18/2020 |
8.1.2 | 1,198 | 8/16/2020 |
8.1.1 | 1,260 | 8/15/2020 |
8.0.3 | 1,274 | 8/11/2020 |
8.0.2 | 1,296 | 8/7/2020 |
8.0.1 | 1,299 | 8/7/2020 |
8.0.0 | 1,244 | 8/7/2020 |
7.0.1 | 1,355 | 6/28/2020 |
7.0.0 | 1,347 | 6/28/2020 |
5.0.10 | 1,316 | 5/31/2020 |
5.0.9 | 1,415 | 5/30/2020 |
5.0.8 | 1,293 | 5/29/2020 |
5.0.7 | 1,260 | 5/29/2020 |
5.0.5 | 1,351 | 2/27/2020 |
5.0.4 | 1,320 | 2/26/2020 |
5.0.3 | 1,311 | 2/26/2020 |
5.0.2 | 1,317 | 2/25/2020 |
5.0.1 | 1,220 | 2/25/2020 |
5.0.0 | 1,338 | 2/25/2020 |
4.1.5 | 1,279 | 2/23/2020 |
4.1.4 | 1,362 | 2/23/2020 |
4.1.3 | 1,297 | 2/22/2020 |
4.1.2 | 1,290 | 2/22/2020 |
4.1.1 | 1,282 | 2/21/2020 |
4.1.0 | 1,313 | 2/21/2020 |
4.0.9 | 1,403 | 2/7/2020 |
4.0.8 | 1,237 | 2/7/2020 |
4.0.7 | 1,260 | 2/7/2020 |
4.0.5 | 1,273 | 1/28/2020 |
4.0.4 | 1,405 | 1/27/2020 |
4.0.3 | 1,257 | 1/27/2020 |
4.0.2 | 1,400 | 1/16/2020 |
4.0.1 | 1,422 | 1/11/2020 |
4.0.0 | 1,371 | 1/5/2020 |
3.1.7 | 1,421 | 12/17/2019 |
3.1.6 | 1,310 | 12/12/2019 |
3.1.5 | 1,306 | 12/12/2019 |
3.1.4 | 1,320 | 12/5/2019 |
3.1.3 | 1,355 | 12/4/2019 |
3.1.2 | 1,378 | 11/30/2019 |
3.1.1 | 1,539 | 11/26/2019 |
3.1.0 | 1,339 | 11/10/2019 |
3.0.4 | 1,180 | 11/1/2019 |
3.0.3 | 1,346 | 10/28/2019 |
3.0.2 | 1,360 | 10/28/2019 |
3.0.1 | 1,351 | 10/26/2019 |
3.0.0 | 1,179 | 10/23/2019 |
2.1.4 | 976 | 10/21/2019 |
2.1.3 | 1,312 | 10/21/2019 |
2.1.2 | 1,443 | 10/21/2019 |
2.1.1 | 1,318 | 10/19/2019 |
2.1.0 | 1,368 | 10/19/2019 |
2.0.9 | 1,065 | 10/18/2019 |
2.0.8 | 1,336 | 10/18/2019 |
2.0.7 | 1,073 | 10/18/2019 |
2.0.6 | 1,062 | 10/18/2019 |
2.0.5 | 1,117 | 10/18/2019 |
2.0.4 | 1,076 | 10/17/2019 |
2.0.3 | 1,209 | 10/16/2019 |
2.0.2 | 1,193 | 10/15/2019 |
2.0.1 | 1,236 | 10/14/2019 |
2.0.0 | 1,072 | 10/13/2019 |
1.1.7 | 1,404 | 10/11/2019 |
1.1.6 | 1,352 | 10/11/2019 |