The stored proc portion of interest is here:
--return products
SELECT TOP (@RowsToReturn)
p.[Id]
,p.[ProductTypeId]
,p.[ParentGroupedProductId]
,p.[VisibleIndividually]
,p.[Name]
,p.[ShortDescription]
,p.[FullDescription]
,p.[AdminComment]
,p.[ProductTemplateId]
,p.[VendorId]
,p.[ShowOnHomepage]
,p.[MetaKeywords]
,p.[MetaDescription]
,p.[MetaTitle]
,p.[AllowCustomerReviews]
,p.[ApprovedRatingSum]
,p.[NotApprovedRatingSum]
,p.[ApprovedTotalReviews]
,p.[NotApprovedTotalReviews]
,p.[SubjectToAcl]
,p.[LimitedToStores]
,p.[Sku]
,p.[ManufacturerPartNumber]
,p.[Gtin]
,p.[IsGiftCard]
,p.[GiftCardTypeId]
,p.[OverriddenGiftCardAmount]
,p.[RequireOtherProducts]
,p.[RequiredProductIds]
,p.[AutomaticallyAddRequiredProducts]
,p.[IsDownload]
,p.[DownloadId]
,p.[UnlimitedDownloads]
,p.[MaxNumberOfDownloads]
,p.[DownloadExpirationDays]
,p.[DownloadActivationTypeId]
,p.[HasSampleDownload]
,p.[SampleDownloadId]
,p.[HasUserAgreement]
,p.[UserAgreementText]
,p.[IsRecurring]
,p.[RecurringCycleLength]
,p.[RecurringCyclePeriodId]
,p.[RecurringTotalCycles]
,p.[IsRental]
,p.[RentalPriceLength]
,p.[RentalPricePeriodId]
,p.[IsShipEnabled]
,dbo.GetIsFreeShippingFromFirstVariant(p.[Id],p.[IsFreeShipping],p.[ProductTypeId]) As [IsFreeShipping]
,p.[ShipSeparately]
,p.[AdditionalShippingCharge]
,p.[DeliveryDateId]
,p.[IsTaxExempt]
,p.[TaxCategoryId]
,p.[IsTelecommunicationsOrBroadcastingOrElectronicServices]
,p.[ManageInventoryMethodId]
,p.[ProductAvailabilityRangeId]
,p.[UseMultipleWarehouses]
,p.[WarehouseId]
,p.[StockQuantity]
,p.[DisplayStockAvailability]
,p.[DisplayStockQuantity]
,p.[MinStockQuantity]
,p.[LowStockActivityId]
,p.[NotifyAdminForQuantityBelow]
,p.[BackorderModeId]
,p.[AllowBackInStockSubscriptions]
,p.[OrderMinimumQuantity]
,p.[OrderMaximumQuantity]
,p.[AllowedQuantities]
,p.[AllowAddingOnlyExistingAttributeCombinations]
,p.[NotReturnable]
,p.[DisableBuyButton]
,p.[DisableWishlistButton]
,p.[AvailableForPreOrder]
,p.[PreOrderAvailabilityStartDateTimeUtc]
,p.[CallForPrice]
,p.[Price]
,p.[OldPrice]
,p.[ProductCost]
,p.[CustomerEntersPrice]
,p.[MinimumCustomerEnteredPrice]
,p.[MaximumCustomerEnteredPrice]
,p.[BasepriceEnabled]
,p.[BasepriceAmount]
,p.[BasepriceUnitId]
,p.[BasepriceBaseAmount]
,p.[BasepriceBaseUnitId]
,p.[MarkAsNew]
,p.[MarkAsNewStartDateTimeUtc]
,p.[MarkAsNewEndDateTimeUtc]
,p.[HasTierPrices]
,p.[HasDiscountsApplied]
,p.[Weight]
,p.[Length]
,p.[Width]
,p.[Height]
,p.[AvailableStartDateTimeUtc]
,p.[AvailableEndDateTimeUtc]
,p.[DisplayOrder]
,p.[Published]
,p.[Deleted]
,p.[CreatedOnUtc]
,p.[UpdatedOnUtc]
,[dbo].[GetTotalSqFtAvailable](p.Id,p.StockQuantity) AS SqFtInStock
FROM
#PageIndex [pi]
INNER JOIN Product p with (NOLOCK) on p.Id = [pi].[ProductId]
WHERE
[pi].IndexId > @PageLowerBound AND
[pi].IndexId < @PageUpperBound
ORDER BY
[pi].IndexId
Note: I changed the select * to select p.columnname for each so I could add another column outputted called SqFtInStock (a UDF that computes a value for display later)
If I edit the product.cs file and put in
///<summary>
/// SqftInStock
/// </summary>
public decimal SqFtInStock { get; set; }
When running, I get the following error:
SqlException: Invalid column name 'SqFtInStock'.
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
I'm not sure why this is happening nor where else I need to make changes besides the Product entity and can't use EF because this column does not exist in the Product table.
Anyone have any idea all the different classes that need to be manually changed to add this extra column?