Cloud.Extensions.Exceptions
1.0.0
dotnet add package Cloud.Extensions.Exceptions --version 1.0.0
NuGet\Install-Package Cloud.Extensions.Exceptions -Version 1.0.0
<PackageReference Include="Cloud.Extensions.Exceptions" Version="1.0.0" />
paket add Cloud.Extensions.Exceptions --version 1.0.0
#r "nuget: Cloud.Extensions.Exceptions, 1.0.0"
// Install Cloud.Extensions.Exceptions as a Cake Addin #addin nuget:?package=Cloud.Extensions.Exceptions&version=1.0.0 // Install Cloud.Extensions.Exceptions as a Cake Tool #tool nuget:?package=Cloud.Extensions.Exceptions&version=1.0.0
This is used to handle all exceptions globally, we have to use in our .Net Core API.Please find the below code samples to use the Cloud.Extensions.Exceptions.
public void ConfigureServices(IServiceCollection services) { //to work with include linq statment (navigaiton properties) services.AddMvc() .AddJsonOptions( options ⇒ options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore );
//max json string length
services.AddMvc()
.AddJsonOptions(
options => options.SerializerSettings.MaxDepth = int.MaxValue
);
//global exception handler
services.AddMvc(
config =>
{
config.Filters.Add(typeof(ApiExceptionFilter));// Please add the nuget package and just add the simple piece code to capture all exceptions.
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
// CORS enabled
services.AddCors(o => o.AddPolicy("HospitalStatistics", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
}));
services.Configure<IISOptions>(options =>
{
options.AutomaticAuthentication = false;
});
//register dependencies(DI)
services.AddAppDependencies(Configuration);
var serviceProvider = services.BuildServiceProvider();
}
///////////////// And above code is to capture all exceptions & log and below Nuget Package is for logging and place in our local folder as in text files on today date. Install-Package Cloud.Extensions.Logging -Version 1.0.0
public static IWebHostBuilder CreateWebHostBuilder(string[] args) ⇒ WebHost.CreateDefaultBuilder(args) .UseContentRoot(Directory.GetCurrentDirectory()) .ConfigureLogging((context, builder) ⇒ { builder.AddFile(opts ⇒ { context.Configuration.GetSection("FileLoggingOptions").Bind(opts); }); }) .UseIISIntegration() .UseStartup<Startup>();
Product | Versions 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.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.1
- Microsoft.AspNetCore.Mvc (>= 2.1.1)
- Microsoft.Extensions.Logging.Abstractions (>= 2.1.1)
- Westwind.Utilities (>= 3.0.7)
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.0 | 998 | 8/5/2019 |