Skip to content

Instantly share code, notes, and snippets.

@aikmeng
Created September 25, 2013 15:13
Show Gist options
  • Save aikmeng/6701132 to your computer and use it in GitHub Desktop.
Save aikmeng/6701132 to your computer and use it in GitHub Desktop.
Create wrapper for DBContext
namespace ExperimentNinjectEF.Data.Interface
{
public interface IDbContext : IDisposable
{
DbSet<TEntity> Set<TEntity>() where TEntity : class;
int SaveChanges();
}
}
namespace ExperimentNinjectEF.Data
{
public class BloggingContext : DbContext, IDbContext
{
public IDbSet<Blog> Blogs { get; set; }
public IDbSet<Post> Posts { get; set; }
public BloggingContext()
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment