score:-1
Try this.
It may fail in case of database operations but for mockups it will do just fine because of concise
operations.
flatLicenseOrderId = (from users in this.CustomerEntities.UserMappers
.Where(x=>x.CompanyId==CompanyId && x.IsActive)
join order in this.CustomerEntities.Orders
on users.customerid equals order.customerid
into orderDetails
from customerOrder in orderDetails.DefaultIfEmpty()
join orderdetails in this.CustomerEntities.OrderDetails
on customerOrder?.OrderId equals orderdetails.OrderId
select new{users.customerid,orderdetails.OrderId})
.Distinct().ToList();
Source: stackoverflow.com
Related Articles
- Exception in Temporary created table in EF linq mocking
- Mocking Delegate.Invoke() using Moq throws InvalidCast exception in LINQ
- LINQ Source Code Available
- Exception in a CRM LINQ query with joins. Attribute in second table doesn't exist
- creating Linq to sqlite dbml from DbLinq source code
- IDisposable created inside Linq - Exception Safety
- Create and insert from Temporary table using Linq to SQL in DBML
- Make access possible to dynamic table LINQ EF6 Code First
- Null reference exception in my LINQ to XML code
- source code for LINQ 101 samples
- C# - LINQ query returns null to table and throws exception
- How to reinsert data from one table onto itself using LINQ in code migration?
- Update query on temporary table in Linq
- How to join one row to every row in source table using LINQ
- Does Linq in Entity Framework code first use SQL or does it get the whole table first?
- LINQ NotSupportedOperation exception with Code First
- A temporary table using LINQ
- c# Linq or code to extract groups from a single list of source data
- How to Insert data in Join table which were created by using EF Code First
- check if table has been created in code first approach
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Distinct in Linq based on only one field of the table
- Linq code to select one item
- What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?
- How are people unit testing code that uses Linq to SQL
- Sequence contains no elements exception in linq without even using Single
- Strange LINQ To Entities Exception
- LINQ Single() Exception for 0 or multiple items
- Casting to a derived type in a LINQ to Entities query with Table Per Hierarchy inheritance
- LINQ Source Code Available
- SQL running sum for an MVC application
- Groupby, sum with multiple joins in Linq lambda
- How to bind to a specific item inside a parent Collection MVVM WPF
- How to check comma separated values stored in data base column having the given value using linq in c#
- When do LINQ Lambdas execute in a foreach loop
- Different way of using LINQ in joining a single table
- could not translate expression into sql
- xml c# add element with Linq to Xml
- How to use Reflection with Non-Generic Types
- Is there a way to run the query and inspect the aggregate data without rerunning the query again?
- Sorting DataSet Rows in a very specific non alphabetical order
- Split a list into multiple lists using lambda expression
- Dynamics CRM Linq validation
- C# Outer Apply in LINQ
- How do I order a dictionary based off of another dictionary? C#
- How is join+into clause converted to GroupJoin
- Building an Expression tree for Comparison Operations with value concatenated e.g ">= 1"
- LINQ - Match value, if not, return NULL element
- What's the meaning of the angle brackets on LINQ methods in Intellisense? (Contains<>, Count<>, Distinct<>, etc.)