Plugin Inheriting from CustomerContent

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I am building a custom plugin and this plugin will have an a review type system, where the customer can leave a comment.

Now I noticed that blog comments and news comments etc etc, inherit from CustomerContent, I did this as well but when I went to install the plugin it appeared to want to create all the tables again for the whole site as opposed to just the tables the plug in uses.

Any ideas how to fix this or why if I inherit from CustomerContent that it does that?

PS it's working fine when the objects inherit from BaseEntity

Thanks
12 years ago
dswatik wrote:
I am building a custom plugin and this plugin will have an a review type system, where the customer can leave a comment.

Now I noticed that blog comments and news comments etc etc, inherit from CustomerContent, I did this as well but when I went to install the plugin it appeared to want to create all the tables again for the whole site as opposed to just the tables the plug in uses.

Any ideas how to fix this or why if I inherit from CustomerContent that it does that?

PS it's working fine when the objects inherit from BaseEntity

Thanks


This happens because you have mapped the CustomerContent class in your object context. When you generate your database script it doesn't check to see if the object already exists it just generates the required schema for your plugin.

I personally avoid registering nopCommerce core objects in my plugins, but you could try and write your own install script SQL that does not include nopCommerce core objects. I haven't tested this and I would guess it will introduce more problems later down the line so take caution.
12 years ago
skyler.severns wrote:


This happens because you have mapped the CustomerContent class in your object context. When you generate your database script it doesn't check to see if the object already exists it just generates the required schema for your plugin.

I personally avoid registering nopCommerce core objects in my plugins, but you could try and write your own install script SQL that does not include nopCommerce core objects. I haven't tested this and I would guess it will introduce more problems later down the line so take caution.


Thanks Skyler for the response.

I realized it probably wouldn't be a good idea to do what I was attempting to do. So I just used an inferred relationship, by adding memberId to my table and then if I need to grab the member for the custom table record than I'll just write a method to do so.

One thing I wish Nop had and I've been actually researching the best way to go about it is a feature added to allow you to build custom content types, such as Orchard does or even Sitefinity CMS does. So basically add more CMS type functionality into Nop.

Anyhow again thanks for your help.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.