right having a bit of a hard mental blog with some Linq to SQL and MVC.
Getting the basic MVC and L2SQL going ok.
- FK relationships. -> when using MVC and we have a fk relationship in the model, and the view is based on a strongly typed object - how do you get the data from the related table?
So for example
User (Table)
UserId
UserName
Call (Table)
CallId
UserId
CountryId
Country(Table)
CountryID
CountryName
SO I want to get only the calls for a user with a specific country?
The view - based on Call Object as this is the "Details" view -
how do i get a UserName and CountryName and still maintain a view based on Call?
It would seem that I still have to create an Object CallForUserByCountry - but this gets messy on save as the CallForUserByCountry object also needs to implement how to create Call User and Country.
the linq query
var calls = from c in db.Call
where c.CountryID == id
select new CallForUserByCountry or new something// this is bit that suggests a new object.
Hopefully I missing something ...