LINQ tutorial Part -III

Save,Update, delete & read by Store procedures In Linq
 
 Dear Friends,
Yesterday we take example of how to use linq for insert ,update & delete. But as a programmer you have question like how to handle store procedures for insert update & Delete.
So here I am with this topic.
Today we will look how to update a table data using same linq but with store procedures.
When you see yesterday example’s mydb.dbml file.

You find that there is two panel(if you are not able to see then right click on orm designer screen and select show method panel).

One where you drag table and the another which is blank so here we use that another panel.

That panel is called method panel you can drop store procedures and function over there as shown in below fig- 1

 

 

 

 

LinqWithStoreProcedures1

 

 

 

After getting procedures & function on method panel you have to do just a simple task.

Just assign the insert ,update & delete method to related table using the custom property and map the fields of store procedure.

For that just check the property of table as shown in fig -2

LinqWithStoreProcedure2

Then click on either insert ,update or delete you will get following screen. Fig-3

LinqWithStoreProcedure3

Just map according to your spname.
And rest the code will be same as we did earlier yesterday. So enjoy coding.
Thanks
Rajat
 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s