Click here to Skip to main content
15,896,063 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Entity Framework : Using summary functions inside a projection Pin
Richard Deeming16-Feb-15 9:36
mveRichard Deeming16-Feb-15 9:36 
GeneralRe: Entity Framework : Using summary functions inside a projection Pin
dilkonika16-Feb-15 15:24
dilkonika16-Feb-15 15:24 
GeneralRe: Entity Framework : Using summary functions inside a projection Pin
Richard Deeming17-Feb-15 3:17
mveRichard Deeming17-Feb-15 3:17 
QuestionHow do I upload a image for a user profile ? Pin
Member 1144766215-Feb-15 5:35
Member 1144766215-Feb-15 5:35 
QuestionRe: How do I upload a image for a user profile ? Pin
Richard MacCutchan15-Feb-15 6:12
mveRichard MacCutchan15-Feb-15 6:12 
AnswerRe: How do I upload a image for a user profile ? Pin
Member 1144766215-Feb-15 6:35
Member 1144766215-Feb-15 6:35 
GeneralRe: How do I upload a image for a user profile ? Pin
Richard MacCutchan15-Feb-15 6:51
mveRichard MacCutchan15-Feb-15 6:51 
QuestionEntity Framework : Which method has better performance ? Pin
dilkonika13-Feb-15 10:57
dilkonika13-Feb-15 10:57 
Hello !

I'm using entity framework , and I have several cases where I should run a query than return some parent items , and after I display these parents and the related children in one report.

I want to know which of these methods have the better performance : ( or is there any other better method ??? )
SQL
Method1: (the childs collection are loaded later , using lazy loading)
Dim lista as IQueryable(Of MyObj) = (From t In context.MyObjs Where(..condition..) select t).Tolist

VB
Method2:
Dim lista as IQueryable(Of MyObj) = (From t In context.MyObjs Where(..condition..) _
            .Include(Function(t2) t2.Childs1) _
             .Include(Function(t2) t2.Childs2) _
             .Include(Function(t2) t2.Childs2.Child22) _
              .Include(Function(t2) t2.Childs1.Childs11) _
              .Include(Function(t2) t2.Childs1.Childs12) _
              Select t).ToList

VB
Method3:
Dim lista as IQueryable(Of MyObj)
Dim lst= (From t2 In context.MyObjs Where(..condition..) Select New with _
       {    .Parent=t2
            .ch1=t2.Childs1 _
             .ch2=t2.Childs2 _
             .ch21=t2.Childs2.Child21) _
             .ch11=t2.Childs1.Childs11) _
              .ch12= t2.Childs1.Childs12 _
              ).ToList
 lista=lst.Select(Function(t2) t2.parent)


I noticed that the first method cause the report to open very slow.

Also I read somewhere that Include() cause repeat of parent items , lik in this example :
VB
For example: Master -> Details.  Say, master has 100 rows, Details has 5000 rows (50 for each master).

If you lazy-load the details, you return 100 rows (size: master) + 5000 rows (size: details).

If you use .Include("Details"), you return 5000 rows (size: master + details).  Essentially, the master portion is duplicated over 50 times.


I don't know the logic when use Projections like in the third mode ? Are the master rows duplicated ?????
But anyway I want a professional opinion in general for the three methods.

Thank you !
AnswerRe: Entity Framework : Which method has better performance ? Pin
Eddy Vluggen13-Feb-15 11:58
professionalEddy Vluggen13-Feb-15 11:58 
GeneralRe: Entity Framework : Which method has better performance ? Pin
dilkonika13-Feb-15 13:13
dilkonika13-Feb-15 13:13 
GeneralRe: Entity Framework : Which method has better performance ? Pin
Dave Kreskowiak13-Feb-15 15:57
mveDave Kreskowiak13-Feb-15 15:57 
GeneralRe: Entity Framework : Which method has better performance ? Pin
dilkonika13-Feb-15 18:15
dilkonika13-Feb-15 18:15 
GeneralRe: Entity Framework : Which method has better performance ? Pin
Dave Kreskowiak14-Feb-15 2:27
mveDave Kreskowiak14-Feb-15 2:27 
GeneralRe: Entity Framework : Which method has better performance ? Pin
dilkonika14-Feb-15 4:56
dilkonika14-Feb-15 4:56 
GeneralRe: Entity Framework : Which method has better performance ? Pin
Dave Kreskowiak14-Feb-15 8:12
mveDave Kreskowiak14-Feb-15 8:12 
GeneralRe: Entity Framework : Which method has better performance ? Pin
dilkonika14-Feb-15 9:46
dilkonika14-Feb-15 9:46 
GeneralRe: Entity Framework : Which method has better performance ? Pin
Dave Kreskowiak14-Feb-15 9:48
mveDave Kreskowiak14-Feb-15 9:48 
GeneralRe: Entity Framework : Which method has better performance ? Pin
dilkonika15-Feb-15 15:09
dilkonika15-Feb-15 15:09 
GeneralRe: Entity Framework : Which method has better performance ? Pin
Dave Kreskowiak15-Feb-15 16:21
mveDave Kreskowiak15-Feb-15 16:21 
Questionsteganography Pin
Member 1142179312-Feb-15 9:57
Member 1142179312-Feb-15 9:57 
AnswerRe: steganography Pin
Richard MacCutchan12-Feb-15 22:38
mveRichard MacCutchan12-Feb-15 22:38 
AnswerRe: steganography Pin
GuyThiebaut12-Feb-15 22:49
professionalGuyThiebaut12-Feb-15 22:49 
QuestionHow do I recognize a wrong password ? Pin
Member 1144766212-Feb-15 5:48
Member 1144766212-Feb-15 5:48 
AnswerRe: How do I recognize a wrong password ? Pin
Dave Kreskowiak12-Feb-15 5:53
mveDave Kreskowiak12-Feb-15 5:53 
GeneralRe: How do I recognize a wrong password ? Pin
Member 1144766212-Feb-15 7:41
Member 1144766212-Feb-15 7:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.