I have a .NET Core 3.0 class library. It is my first time working with .NET Core
I want to connect to a database.
https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-strings shows exactly how to do it.
https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.configurationextensions.getconnectionstring?view=dotnet-plat-ext-3.1 shows the method which exists in the Microsoft.Extensions.Configuration namespace
I can't access it.
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; //no underlines and imported via Nuget
namespace Core.Cms.DAL
{
public class Entities : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ optionsBuilder.UseSqlServer(Microsoft.Extensions.Configuration.GetConnectionString(ConnectionString.SqlServerExpress));
}
}
}
Screenshot
Why do I not have the Microsoft.Extensions.Configuration.GetConnectionString() method available?
edit
Restarted rider - same issue
Entities.cs(17, 45): [CS0234] The type or namespace name 'GetConnectionString' does not exist in the namespace 'Microsoft.Extensions.Configuration' (are you missing an assembly reference?)
