Created
January 15, 2015 16:45
-
-
Save trailmax/fc507480b4f9137225db to your computer and use it in GitHub Desktop.
ApplicationDbContext trying out some overriding stuff
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
using System.Data.Entity; | |
using System.Threading.Tasks; | |
using IoCIdentity.Models; | |
using Microsoft.AspNet.Identity.EntityFramework; | |
namespace IoCIdentity.Identity | |
{ | |
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>, IApplicationDbContext | |
{ | |
public ApplicationDbContext() | |
: base("DefaultConnection", throwIfV1Schema: false) | |
{ | |
} | |
public override Task<int> SaveChangesAsync() | |
{ | |
return base.SaveChangesAsync(); //no problems here | |
} | |
} | |
public interface IApplicationDbContext | |
{ | |
Task<int> SaveChangesAsync(); | |
//DbSet<Product> Products { get; set; } | |
} | |
public class SomeService | |
{ | |
private readonly IApplicationDbContext dbContext; | |
public SomeService(IApplicationDbContext dbContext) | |
{ | |
this.dbContext = dbContext; | |
} | |
public async Task SomeAction() | |
{ | |
var result = await dbContext.SaveChangesAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment