Created
April 21, 2020 14:01
-
-
Save tluyben/8208fa11ddf29f4d40d5a0ed40abb43d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private T GetContext<T>() where T : DbContext | |
| { | |
| var options = new DbContextOptionsBuilder<T>().UseNpgsql(connection).Options; | |
| return (T) typeof(T).GetConstructor(new Type[] { typeof(DbContextOptions<T>) }).Invoke(new object[] { options }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment