Calling stored procedures

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 Jahre weitere
I know some basics about the .Net framework, but my practical experience is minimal, so I just don't get how this works:

When there is a SQL command involved in NopCommerce (Add a product, edit, delete, update) I get to follow almost all the steps NopCommerce takes to achieve the command.
For example, when adding a new product, I can see the "calling steps" until the SQLProductProider.cs where there is the InsertProduct(...) method.

But how does this link with the actual Stored Procedure? when is the execute needed for this to happen?
If I add a new field to the Nop_Product table and I want to involve it within the normal process, can I just update this method  and the associated stored procedure and that would be all for NopCommerce to insert my new field? (after compiling, of course)

I really appreciate any help since this is one thing I just don't get to see how it works.

Thanks!
14 Jahre weitere
Hey,

Yes within the function InsertProduct you will see that there is a call to the Stored Procedure

DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductInsert");

This stored procedure takes a certain amount of parameters you need to add your new field as a parameter, then it will be passed through into the Stored Procedure.

But you will also need to add your new parameter to the function InsertProduct, doing this you will need to also update InsertProduct within the DBProductProvider.cs file and also within the ProductManager.cs file.

You should also add your new field to the Product.cs file and the DBproduct.cs file and update the mapping between the two.


Thanks

Simon
14 Jahre weitere
Hey Simon, what's up! (haha, never had used that expression before, hope it doesn't bother you)

I want to thank you for your help.

I just can say I just can't believe I didn't see that! It was in front of my nose and I just didn't see it! All what I was looking for was in the method I reviewed to compose my question!

Also thanks for your comments  about the modifications required on the ProductManager.cs, Product.cs and DBProduct.cs, I think you just saved me some time.

Take care!

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