TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sanket Jain
NA
855
140.2k
How to override appsettings.json with environment variables?
Jan 31 2020 1:26 AM
How to override appsettings.json with environment variables for connection string in onconfiguring method in dbcontext class in ASP.NET Core 3.0 project ?
I wrote below code in
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json")
.Build();
optionsBuilder.UseSqlServer(configuration.GetConnectionString("UserDBContext"));
}
}
Reply
Answers (
1
)
Copy MySQL database to SQL Server using .Net
boostrap or html email templated