Skip to content

Instantly share code, notes, and snippets.

@kelumKP
Created February 28, 2021 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelumKP/914dc97124999083d1f8c58285dd396f to your computer and use it in GitHub Desktop.
Save kelumKP/914dc97124999083d1f8c58285dd396f to your computer and use it in GitHub Desktop.
Test DB Context
public class TestDBContext : DbContext, IContext
{
public TestDBContext() : base("Name=DB_CONNECTION_STRING"){}
public TestDBContext(DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection){}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
base.OnModelCreating(modelBuilder);
}
public IDbSet<SampleTable> SampleTables { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment