I have a difficulty here in this lambda, I would like to know how I select the entire object without having to specify all its properties.
As if it were a: SELECT * FROM SomeCase
Without having to specify as: SELECT ID, BLA, BLE FROM Some
I already have a piece of how I want it:
var query = this.clientDbContext.Printers
.Where(p => p.PlaceId == placeId);
if (!getRemoved)
query = query.Where(where => where.WasRemoved == false);
if (onlyWithCounters)
query = query
.Join(this.systemDbContext.PrinterCounter, printer => printer.PrinterId, pc => pc.PrinterId, (printer, pc) => new { Printer = printer })
.Select(select => select.Printer);
I do not know if this is the correct way to do it, I would like the more experienced ones to help me:)
I thought that in this part I did:
(printer, pc) => new { Printer = printer })
This would solve
(printer, pc) => printer)
To clarify, I want to simulate this:
.Join(this.systemDbContext.PrinterCounter, printer => printer.PrinterId, pc => pc.PrinterId, (printer, pc) => new { Printer = printer })
.Select(select => select.Printer);
That:
SELECT *
FROM [*banco do cliente*].[dbo].[Printers] AS printer
JOIN [*banco principal*].[dbo].PrinterCounter AS cp ON printer.PrinterId = cp.PrinterId