ASP.NET Core ConfigurationProvider from database - asp.net-core

I wonder if there is implemented ConfigurationProvider for ASP.NET Core which loads options from Database. EF or Dapper.
It's fairly easy to implement ourselves, but I wonder if there is ready solution, and if this really a good idea.

According to your description, I suggest you could try to use EfConfigurationProvider, you could directly use by installing through nuget package.
Install-Package EfConfigurationProvider -Version 0.2.1
More details about how to use it ,you could refer to this article.
If this doesn't match your requirement, I suggest you could create the custom provider by yourself, like this blog shows.

Related

How to add support for Cosmos db in .Net framework v4.8 Web Api project?

I have a project built in .net framework v4.8 and I have to add support for Cosmos DB to perform CRUD operations. How to achieve that as Microsoft.Azure.DocumentDB package is deprecated now?
Yes, the Nuget package Microsoft.Azure.DocumentDB is deprecated and the Alternate for this is Microsoft.Azure.Cosmos
Please refer Generic CRUD Operations For CosmosDB for more information
There are lots of public guides about creating applications, including the scenario you are describing: https://learn.microsoft.com/azure/cosmos-db/sql/sql-api-dotnet-application
If you already have an application using the V2 SDK (Microsoft.Azure.DocumentDB), you can use the migration guide to migrate it to V3 (Microsoft.Azure.Cosmos): https://learn.microsoft.com/azure/cosmos-db/sql/migrate-dotnet-v3

no option for database templates in new item window

I'm creating asp.net core web application and there'is no database templates in new item window. I've installed "Data storing and processing", "Entity framework 6 tools". I'm actually want to create ADO.net template, but it seems to be I need to install something for any database templates to appeared
ADO.net template is removed in Asp.Net core.And NET Framework, as Entity Framework 6 doesn't support . NET Core.So you should use Entity Framework Core rather than Entity framework in Asp.net core.
If you want to use Entity Framework Core with an Existing Database in Asp.net core,you can refer to the official tutorial.
That looks like normal behavior. In .NET Core you'll need to use Entity Framework Core. If you're trying to reference an existing database, you'll need to scaffold it as they've done away with EDMX models in EF Core. Here's how:
If you don't have it already, install the Microsoft.EntityFrameworkCore.Tools NuGet package and any other EF Core packages you think you might need. For example, if you're developing against SQL Server, install the Microsoft.EntityFrameworkCore.SqlServer package.
Run the scaffolding command in the VS Package Manager Console for the database you're trying to add. Something like the following, although you'll want to read the documentation first to determine the parameters you need:
Scaffold-DbContext 'Data Source=(local);Database=MyDB;Trusted_Connection=True' Microsoft.EntityFrameworkCore.SqlServer
This will create a context class for your database that you can then reference throughout your project.

Is the ASP.NET Core NuGET package Microsoft.AspNetCore.Hosting version 2.2.7 part of ASP.NET Core 5.0?

I am getting a little confused by all the naming and versioning of .NET. I think I understand the whole .NET Framework / Standard / Core thing, but I am now moving into ASP.NET Core territory (I want to give my console application a web interface with Kestrel).
When using the NuGET package manager, I can see the Microsoft.AspNetCore.Hosting package, needed to run the webserver. But the highest available version is 2.2.7.
Question now, is that 2.2.7 part of ASP.NET Core 5.0, or do I have some configuration incorrect that I do not get the latest version for my application?
And if it is indeed part of ASP.NET Core 5.0, where can I find that reference? This table helped me a lot with understanding the core libraries.
I assume you wanna this document which tells about your package :
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting?view=aspnetcore-5.0
And I think you can focus on those classes or interfaces you'll use and take a look if those are supporting .net 5 by click and refer to the details page. You'll see Applies to at the bottom of each page such as this one.
If I misunderstood in some place which made my post isn't suitable to display here, pls point it out and I'll delete it.

Differences between "Microsoft.Extensions.Caching.Redis" and "Microsoft.Extensions.Caching.StackExchangeRedis.Redis"?

I am a little bit lost. I am reading Microsoft documentation for ASP.NET Core caching using Redis.
And the documentation suggests to use Microsoft.Extensions.Caching.StackExchangeRedis which is an open source third party library.
But I've seen some other tutorials are using Microsoft.Extensions.Caching.Redis, which is a more native asp.net core.
And at the end they both use the same interface IDistributedCache.
Why do I need Microsoft.Extensions.Caching.StackExchangeRedis?
What advantages it has over Microsoft.Extensions.Caching.Redis?
A look at the dependency graph for Microsoft.Extensions.Caching.Redis and Microsoft.Extensions.Caching.StackExchangeRedis reveals it.
Microsoft.Extensions.Caching.Redis is based on StackExchange redis 1.x library, whereas Microsoft.Extensions.Caching.StackExchangeRedis is based on 2.x of the same library.
Also Microsoft.Extensions.Caching.Redis doesn't seem to target the 3.1 extension libraries (Microsoft.Extensions.Options/Caching.Abstractions) where the other does.
So for .NET Core 3.x and newer use Microsoft.Extensions.Caching.StackExchangeRedis as the previous one may not be maintained as long as the new one.

Where are the nuget authentication packages for aspnet core 3?

I have a custom authentication component that is working with net core 2.2. I've started migrating the project to net core 3, but it seems like MS hasn't updated the authentication Nuget packages.
Until now, I was referencing the Microsoft.AspNetCore.Authentication package. The package still exists, but hasn't been updated to net core 3.0 (it's still on the 2.2 version).
I can't keep using it because net core 3.0 has moved the RequestPathBaseCookieBuilder type to a different namespace (so, at runtime, I'll get a tyoe loading exception). A quick search shows that only the Microsoft.AspNetCore.Authentication.OpenIdConnect has been updated to net core 3.0 (and if I add it to my project, then my component to work without any issues).
Anyone knows why MS hasn't still updated the other security nuget packages to version 3? Is there anyway to solve this without using the openidconnect nuget package (I'm only using it because it was the first that was updated and it will bring the correct Microsoft.AspNetCore.Authentication assembly that I need for my project)?
Looks like I was 10 minutes too late, but you posted the answer as a comment, rather than an answer, and I like questions having answers so I stop opening them when browsing the question search results.
Anyway, as you discovered, .NET Core 3.0 no longer uses packages for base class libraries (BCLs). Instead, they're just part of the SDK, so by targeting netcoreapp3.0 or netstandard2.1, all BCLs are just available. This should eliminate a lot of problems that earlier .NET Core projects had, particularly when referencing .NET Standard 1.x assemblies from netcoreapp2.x tfms. Although the largest benefit will be when all referenced packages target netstandard2.1 or netcoreapp3.0 or above.
Ok, so finally got it. The solution is to use the FrameworkReference element with the Microsoft.AspNetCore.App meta package.