Shawn Mclean
Shawn Mclean

Reputation: 57469

Code First with model coming from seperate database

I'm creating a chat system but the user table is from a seperate database. But on my database, I have Message which has a User parent. How do I handle a situation like this? I know when a user is logged in and I have their Id. Should I create a new user table and if the id does not exist I create it when creating a new message? What other option is there?

I'm using Entity Framework Code-first.

Upvotes: 0

Views: 40

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364259

Simply use the Message table with just UserId column. Data integrity and loading of related user would be done by your application logic. EF doesn't need to know anything about that.

Upvotes: 1

Related Questions