extend Services product repository to use entity at plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi, I develop a plugin, but I require to access the product repository. I just notice tutorial just teach how to create new entity but not using an existing. Is that anywhere I can access the entity?
6 years ago
You can learn much from this course.

https://app.pluralsight.com/library/courses/nopcommerce-plugin-development/table-of-contents
6 years ago
Initiate repository with inline code like below:

var productRepository = EngineContext.Current.Resolve<IRepository<Product>>();


If you prefer constructor injection, then:

private readonly IRepository<Product> _productRepository; // class level variable

public YourClass(IRepository<Product> productRepository)
{
   _productRepository = productRepository;
}


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.