Get connection string from appsettings.json in ASP.Net Core

preview_player
Показать описание

👉FOLLOW US:

🧱 Affiliate Links: (ASP.NET Core Full Courses)
-------------------------------------------------------------------------------------
🅾 Complete Guide to ASP.NET Core MVC (.NET 5)
🅾 .NET 5 & .NET Core 3.1 Web API & Entity Framework
🅾 RESTful API with ASP.NET Core Web API - Create and Consume
🅾 Complete Guide to Building an App with .NET Core and React
🅾 Build a Real-world App with ASP.NET Core and Angular
-------------------------------------------------------------------------------------

👉ASP.NET Core Tutorial Playlist:
============================

👉ASP.NET Core WEB API Playlist:
============================

👉Blazor Tutorial Playlist:
============================

👉ASP.NET Core Authentication Playlist:
============================

👉SignalR Tutorials Playlist:
============================

👉KENDO UI Tutorials (WEB DEVELOPMENT) Playlist:
=====================================

👉KENDO UI in ASP.NET Core Playlist:
=====================================

👉Files or Image Upload Playlist:
=====================================

👉==========AMCHARTS GRAPH JQUERY PLAYLIST==========

👉=================RDLC Report PlayList===============

👉=================RDLC PRINT===============
How to print without showing report viewer in RDLC report - C#

👉=================RDLC & Crystal Report===============

👉=================SQL Server Tutorials (Series)===============

👉=========TEAM FOUNDATION SERVER=============
TFS source control for beginners:

👉==========ANDROID APP DEVELOPMENT============
Quick Learn Android full basic in 45 minutes:

👉=================C# Basic=============================

#ConnectionStringInAspNetCore #AppSettingsJson #GetConnectionStringInCore
Рекомендации по теме
Комментарии
Автор

THANKS!!! The demo of your ConnectionManager class starting around 6:26 was EXACTLY what I needed. Much easier to digest than most of what I found trying to track this down.

busterbrown
Автор

I was worried that you weren't going to show how to do this from a separate project, but you did! Thank you so much!!

bardus_hobus
Автор

Missing the .net days, where it'd take 10 secs to accomplish this.

russelldodd
Автор

Can you tell me how to use it in Worker Service Project

musiclover
Автор

I needed a way to get the connectionString into my DAL.dll too. As my Asp.Net Core app has a reference to my DAL I could not have a reference in my DAL.dll to my Asp.Net Core app because of circular reference problems.. You solution works and I have seen it else where but then isn't it a problem to have two ConfigurationBuilder ? One in Startup and one in DAL?

franzcisco-tx
Автор

public Value(IOptions<MyOptions> option){
this.conn = option.Value.ConnString;


}

anikbiswas
Автор

public class MyOptions
{
public string ConnString { get; set; }
}

anikbiswas