Reputation: 11104
I'm quite new to Entity Framework and want to catch a grasp on how some things should be done properly. I have 2 tables:
Client is connected with Person by PersonID. Now I want to display it in ListView showing only ClientName (so JOIN with PERSON - Person.Name) and Client.Comment.
Then user will be able to double click on that Client and this will bring him to edit window with all Person Details that he will be able to change.
How this should be done? I thought about creating one of:
Creating view_ which will only give me 4 columns (4 with ClientID, PersonID, Person.Name, Client.Comment)
IQueryable<view_KlienciList> klientQuery1 = from d in crmEntities.view_KlienciList select d;`
var klientQuery1 = context.view_KlienciList.Select(d => new { Nazwa = d.Nazwa
});
Doing a select with just some columns
IQueryable<Klienci> klientQuery = from d in crmEntities.Kliencis.Include("Podmioty")
select d (......)
So which is better and why should I go this way? Considering that when user double clicks on user again I will have to load all columns from Client,Person for that selected person.
Upvotes: 2
Views: 100
Reputation: 9314
the second one kills the lazy loading feature , but has its own merits in certain situations.
Upvotes: 1