How to access current database with easy way in plugin?

Posted: March 13, 2019 at 5:57 PM Quote #225009
Hello everyone.I want to acces current database(database that was created while nopcommerce instalatio n) in my plugin's controller.Is there an easy way to do this.For example Datacontext db =new Datacontext(); or something like this?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 13, 2019 at 8:01 PM Quote #225015
Hello,

There are lots of way to access it.

But best is to follow nopcommerce structure.

You have to create service for that and this service you must register at dependency register file of your plugin.

That's way you have to access db.

Hope you will understand..!!
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
I am passionate about new ideas and new way of thinking :-)

Cheers,
Smiten Kalathiya
Posted: March 14, 2019 at 7:24 AM Quote #225043
what u mean at service ?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 14, 2019 at 8:20 AM Quote #225051
what is the service for current database,that i should register?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2019
Learn more