I\'m currently trying to implement the repositories for my domain objects with the RC of Entity Framework 4.1 and its code first approach. Now I have a domain entity \"Voyag
For an isolated class you could do a read-only workaround by adding a "get" method to your DbContext that does a SqlQuery<>
and maps the table to the class internally (the old-fashioned way).
I've worked up a minimal test-case here: https://github.com/timabell/ef-complex-pk
e.g.
public class TestDbContext : DbContext
{
public IEnumerable GetUberWidgets()
{
return Database.SqlQuery("select WidgetId, Name from Widgets")
.Select(dto => new UberWidget
{
UberWidgetId = new IdWrap { IdWrapId = dto.WidgetId },
Name = dto.Name
});
}
}