How can I use Distinct (C# statement)
var query = from log in ViewLogs join v in Vehicles on log.VehicleId equals v.VehilceId join d in Sellers on v.SellerId equals d.SellerId where v.IsActive && !v.IsDeleted && d.IsActive && d.IsPublic select log.VehicleId; query.Dump();I want the Distinct VehicleId to be listed. VehicleId is Guid. How to do this?
Also is there an option that I run a SQL query that generates the LINQ, i.e. the other way round?
Thanks!
Comments
query.Distinct().Dump();
Note that you would be better off using association properties. You're in for a lot of unnecessary pain if you simply transliterate SQL into LINQ. For more info, read this:
https://www.linqpad.net/WhyLINQBeatsSQL.aspx