There are two database queries you must run:...var IDs = (from a in db1.Table1
join b in db1.Table2 on a.Id equals b.Id
where b.Id == 1 && a.Status == "new"
select new a.Id).ToArray();
var query = from c in db2.Company
join a in IDs on c.Id equals a.Id
Using SqlFunctions is an additional option. Your code will look like this: DateName...var offer = (from p in dc.CustomerOffer
join q in dc.OffersInBranch
on p.ID equals q.OfferID
where q.BranchID == singleLoc.LocationID
let value = (p.OriginalPrice - p.NewPrice) * 100 / p.Origi...
That works. For the dateTime parsing to be secure, you need an Extensionmethod. The outcome of that procedure may then be used in the Linq query. This may not be the best (!) answer in terms of speed since it will get every row from the database. But it offers a response to the query.... void Main()
var stringDates = new List<stri...
I've got the following line of code:...var file = (from p in database.tblFile
join o in database.tblFileVersion on p.fldFileID equals o.fldFileID
join t in database.tblFileAttachments on p.fldFileID equals t.fldFileID
where p.fldFileID == team.Key
where o.fldVersionNo == highestVersion
Think about a scenario where I need to execute and integrate the results of multiple separate database queries. Every single query is built on a parameter that is supplied from somewhere else....One approach would be to run these queries in order, then combine the results:...public IEnumerable<SomeEntity> GetSomeEntities(List<int> parameters)
MyStrings... is a small table...Filtered loading...MyStrings...
then combine with memories from...MyStaticStringTranslations...
LINQ usage...// Read the small table into memory, and make a dictionary from it.
// The last step will use this dictionary for joining.
var byId = db1.MyStrings
.Where(x => homeStrings.Contains(x.Content))
How can I create a query builder engine that allows users to mix many conditions and leverages EF in the backend to query the data according to the conditions, just like TFS does?...It goes somewhat like this: user generates the query, sends json to the backend, and the backend processes the query using the EF code first + repository approach....Th...