-
Notifications
You must be signed in to change notification settings - Fork 3
MigrationsExtensionsDbContextDesignTimeFactory
Dennis C. Mitchell edited this page Mar 17, 2019
·
1 revision
EDennis.AspNetCore.Base provides an abstract implementation of IDesignTimeDbContextFactory in order to simplify/standardize migration-specific configuration aspects of your DbContext (e.g., connection string) and to allow your DbContext class to have just one constructor that takes DbContextOptions<YourDbContextClass> as a parameter.
The base class, MigrationsExtensionsDbContextDesignTimeFactory, makes two assumptions:
- Your DbContext class has a single constructor that takes
DbContextOptions<YourDbContextClass>as a parameter. - You have configured your connection string in either appsettings.json or appsettings.Development.json with the following key:
ConnectionStrings:YourDbContextClass(where YourDbContextClass is the name of your DbContext class).
When these assumptions hold, you can create a trivial subclass of MigrationsExtensionsDbContextDesignTimeFactory as such:
public class YourDbContextClassDesignTimeFactory :
MigrationsExtensionsDbContextDesignTimeFactory<YourDbContextClass> { }For convenience, you may wish to include the above class in the file that contains your DbContext class.
Development Support
- Temporal Entities
- Base Repository Classes
- Base API Controller Classes
- ApiClient and SecureApiClient
- Security Utilities
- IServiceCollection Extension Methods
- HttpClient Extension Methods
- ScopeProperties
- MigrationsExtensionsDbContextDesignTimeFactory
Testing Support
- API Launcher
- Testing Strategy and Infrastructure
- Xunit Support Classes
- Testing Security Utilities
Related Projects