I am using ASP.NET MVC 5 with EF 6. I am trying to follow DDD patern and I have IdentityContext and AddressContext.
public class IdentityContext : IdentityDbContext<ApplicationUser>
{
public IdentityContext()
: base("DefaultConntection", throwIfV1Schema: false)
{
}
public static IdentityContext Create()
{
return new IdentityContext();
}
}
public class AddressContext: DbContext
{
public AddressContext(): base("DefaultConntection"){}
public DbSet<Location> Locations { get; set; }
}
When I am trying to extend(add-migration and update-database) my ApplicationUser which belongs to IdentityContext, I am getting "There is already an object named 'Locations' in the database" error.
public class ApplicationUser : IdentityUser
{
public virtual Nullable<int> LocationId { get; set; }
public virtual Location Location { get; set; }
}
How could I share Location Entity between IdentityContext and AddressContext?
Any help would be appreciated.