how to write linq query with join on 3 tables performing sum and multiplication

How can i write a query in linq c#(EF Core 6) for total price and also map other fields of DTO along with total price.

sql Query:

SELECT (sum(c.ExtraPrice) + (a.PricePerSqM*10)) as TotalPrice FROM dbo.Cities a
JOIN dbo.CityExtras b ON a.CityId = b.CityId
JOIN dbo.Extras c ON b.ExtrasId = c.ExtrasId
where a.CityId = 1
group by PricePerSqM


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation