Extend Domain Entities in new plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
hi there,
i'm new in nopCommerce. i 'm writing a new plugin and during this development i need the Product entity to have 3 more other properties. my problem is when i try to extend the Partial Product entity in my new plugin it does not work properly and non of my new added properties gets extended in main product entity.
how can i add new property into Product entity without changing NopCommere Source code?
7 years ago
mr_taghipour wrote:
hi there,
i'm new in nopCommerce. i 'm writing a new plugin and during this development i need the Product entity to have 3 more other properties. my problem is when i try to extend the Partial Product entity in my new plugin it does not work properly and non of my new added properties gets extended in main product entity.
how can i add new property into Product entity without changing NopCommere Source code?


Hi,

simply said you cannot extend nopCommerce entities from a plugin. The "partial" thing would not work too because partial classes must be in the same assembly. Meaning that, if you have another "Product" class that is "partial" with the new properties it is mandatory to be in the Nop.Code assembly.

What you can do is to create an additional table, with a "productId" where you will store your additional information about the product.

Hope this helps!

Regards,
Hristian
7 years ago
Hi,

You can also use the generic attributes
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.