Categories
Mastering Development

(nopCommerce 4.2) How to execute stored procedure and get return model.?

I’m using nopCommerce 4.2 and trying to get a product list. I have tried using the below code.

var pProductIds = _dataProvider.GetStringParameter("ProductIds", productIds);
var elasticIndexProducts =
_dbContext.QueryFromSql<ProductList>("Exec SP_GetProductsForElastic @ProductIds", pProductIds).ToList();

But I’m getting an error saying “Cannot create a DbSet for ‘ProductList’ because this type is not included in the model for the context.”

This my model

public class ProductList
    {
        public DateTime IndexDate { get; set; }
        public string ProductId { get; set; }
        public string PartNumber { get; set; }
        public string Name { get; set; }
        public string MetaKeywords { get; set; }
        public string MetaDescription { get; set; }
        public string MetaTitle { get; set; }
        public int LimitedToStores { get; set; }
        public string ShortDescription { get; set; }
        public string FullDescription { get; set; }
        public string SeName { get; set; }
}

Leave a Reply

Your email address will not be published. Required fields are marked *