Defining an inner select in an entity

In the Orders class in the Models namespace

public readonly TextColumn ShipPostalCode = new TextColumn("ShipPostalCode", "10") { NullDisplayText = "" };
public readonly TextColumn ShipCountry = new TextColumn("ShipCountry", "15") { NullDisplayText = "" };
public readonly NumberColumn TotalQuantity = new NumberColumn(@"isnull((
Select sum(Quantity)
From dbo.[Order Details] 
Where OrderID = Orders.OrderID
),0)", "5C", "Total Quantity") { DbReadOnly = true}; 

Remember to set the DbReadOnly property, so that this column will only be included in Select statement and will not be included in Update or Insert statements


Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com