|
Last change
on this file since 2859225 was 2859225, checked in by imbrsk <boris696boris@…>, 11 months ago |
|
Implement user management features with database integration
|
-
Property mode
set to
100644
|
|
File size:
714 bytes
|
| Rev | Line | |
|---|
| [2859225] | 1 | using Microsoft.EntityFrameworkCore;
|
|---|
| 2 | using Microsoft.EntityFrameworkCore.Design;
|
|---|
| 3 |
|
|---|
| 4 | namespace iknow_api.Data
|
|---|
| 5 | {
|
|---|
| 6 | public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
|
|---|
| 7 | {
|
|---|
| 8 | public AppDbContext CreateDbContext(string[] args)
|
|---|
| 9 | {
|
|---|
| 10 | var configuration = new ConfigurationBuilder()
|
|---|
| 11 | .SetBasePath(Directory.GetCurrentDirectory())
|
|---|
| 12 | .AddJsonFile("appsettings.json")
|
|---|
| 13 | .Build();
|
|---|
| 14 |
|
|---|
| 15 | var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();
|
|---|
| 16 | optionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
|
|---|
| 17 |
|
|---|
| 18 | return new AppDbContext(optionsBuilder.Options);
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.