I have a slightly weak projection, so I decided to play in the production of a cinema with micro-optimization. Im working on launching on some pretty low performance tablets, so I was looking for ways to speed things up. Given that Im using LINQ to Entities, I looked at pre-compiled queries to boast high performance, and therefore came up with this simple one to return a contact list for this company.
Public ReadOnly pContacts_list_query As Func(Of SpiraxDDWEntities, Integer, IQueryable(Of tblContacts)) = _
CompiledQuery.Compile(Of SpiraxDDWEntities, Integer, IQueryable(Of tblContacts))(Function(ctx As SpiraxDDWEntities, pCompany_ABN As Integer) _
From Contact_data In ctx.tblContacts Where Contact_data.AccountNumber = pCompany_ABN
)
Now thatβs fine, since its only one table, so the IQueryable type may be the name of the table. My question is, what if I wanted to precompile the request using connections? For example, this
Dim Quote_QRY = From Quote_data In linEntities.tblQuote
Join Quote_value_data In linEntities.tblQuoteValue On Quote_data.ID Equals Quote_value_data.QuoteID
Join Quote_status_data In linEntities.tblQuoteStatus On Quote_data.Status Equals Quote_status_data.Abbreviation
Where Quote_data.AccountNo = Me.txtCompany_ABN.Text
Select Quote_data.ID, Status = Quote_status_data.Description, Quote_data.Contact, Quote_data.Project, Quote_value_data.QuoteValue
How can i do this?
thank
source