I'm trying to read the appsetting on my console application as well as to set he EntityFramework connection string.
I did a lot of google but did not found any single solution not even on Microsoft's documentation.
Here is the my questions.
- How to set the EntityFramework connection string?, my entity framework project is separate, for my MVC project I did this as below code.
string connectionString = Configuration.GetConnectionString("DefaultConnection"); services.AddDbContext<MyDBContext>(option =>option.UseSqlServer(connectionString, m => m.MigrationsAssembly("MyMVCDLL"))); services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
- How to read the appsetting?
- How to implement the DI in console applciation to get the appsettings?
Can someone help me with this.