Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Q: IdentityDbContext in WebSite and MyProjectDbContext in separate assembly sharing a table #993

Closed
ghost opened this issue Oct 12, 2016 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Oct 12, 2016

Hello

I have a Web Site with of course an ApplicationDbContext : IdentityDbContext<ApplicationUser>
where my ApplicationUser is :

    public class ApplicationUser : IdentityUser
    {
        public MyProject.Models.UserInfo UserInfo { get; set; }
    }

UserInfo come from MyProject.Models (where I have a MyProjectDbContext) because it used by other project (Web Services, Windows Services...) and is also joined to other table, mainly in history tables...
I wish to keep the ApplicationDbContext (IdentityDbContext) in the web site, and have a separate assembly for my Models.
The pb is that the migration failed because the table UserInfo is in both assembly

Is there a way to do that ?
or
do I have to move the ApplicationDbContext (IdentityDbContext) in my model assembly ?

@ghost ghost changed the title IdentityDbContext in WebSite and MyProjectDbContext in separate assembly sharing a table Q: IdentityDbContext in WebSite and MyProjectDbContext in separate assembly sharing a table Oct 12, 2016
@blowdart
Copy link
Member

@divega

@blowdart blowdart added this to the Discussions milestone Oct 12, 2016
@divega divega removed their assignment Mar 29, 2017
@divega divega removed this from the Discussions milestone Mar 29, 2017
@ajcvickers
Copy link
Member

Sorry for being slow responding--we had some internal team changes. This can be done, but requires that you choose one context that will manage the UserInfo table through Migrations and manually remove anything generated for it by the other context. More info and a better experience for this is tracked by dotnet/efcore#2725

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants