error "There is already an object named 'Address_Country' in the database. while installing plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 лет назад
When i created a new plugin, I added the line in the  OnModelCreating(Function) in the new context class


modelBuilder.Entity<RewardPointsHistory>().HasRequired(p => p.UsedWithOrder).WithOptional();

I am getting error "There is already an object named 'Address_Country' in the database. Could not create constraint or index. See previous errors."

i have not touched the address part! and neither do i have any reference to it!

Please help me fix this issue...
Thanks in advance.........
7 лет назад
I got the exact same issue with you when creating a plugin on 3.8 version, not fixed yet. hope to get advise. Thanks,
7 лет назад
I am experiencing the same error !!!! What is this
7 лет назад
I have the same exact error as well. Does anyone have any suggestions?
7 лет назад
I couldn't solve it but it happens when i made this :

MostViewedProduct : Product

int newfield;

And then

MostViewedProductMap

map the new column


Somehow it gets this error when binding the new field into the database through EF
6 лет назад
Old question but issue still occures.

'Address_Country' is first key in your database if you remove it it will display  smae eror with another available key.

THe issue is because you are creating new model, and you are referrencing you Plugin model to nopCommerce Domain model.Check you Map file and Domain model.
You cannot make any reference to nopCommerce domain model. Use dedicated service for that.

If you realy want to create such a referrence, you have to register new model in plugin as and map it into database model.

Please vote up if it was helpful.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.