Reputation: 1532
In my current solution i have 2 Entityframework Entity Projects. One is DBFirst and the other is CodeFirst. Even though there are some different Properties the important are the same.
eg. ProjectA.User implements Firstname and Lastname and so does ProjectB
I want to be able to call my SendMail function with both Projects User Object and access its Properties.
What is the best way to archieve this?
Some methods i could imagine:
Upvotes: 0
Views: 41
Reputation: 21998
You could have layer to abstract from db/code one and then use common code, something like
void SendEmail(DbFirst obj) { SendMail(obj.Name, obj.LastName, ...); }
void SendEmail(CodeFirst obj) { SendMail(obj.Name, obj.LastName, ...); }
void SendEmail(string name, string lastname, ...) { ... }
Upvotes: 1