Hi,
I have a legacy database which has two collumns and I want to map them as 1 ID is this possible
for example
public class Product
{
public string ProductID {get;set;}
public string ShortDescription {get;set;}
public string UserName {get;set;}
}
then my Modelbinder looks like this
modelBinder.Entity<Product>().
HasKey(p=>p.ProductID)
.MapSingle(product =>
new {
colShotDesc = product.ShortDescription,
colUser = product.UserName
}
).ToTable("Products");
What I need would be something like ProductID = ShortDescription + UserName in the mapping... because these two collumns share a unique key contraint...
Don't know if this makes sens but any suggestions would be great... Please don't ask about the database design => this is like it is and should not be changed... that's why I thought EF code-first could help me (hope cross fingers)... because it looks like the db hasn't got pk defined just unique key constraints...
anyway ... help would be terrific..