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?开发者_如何学C 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.
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.
精彩评论