filmov
tv
Part 5 Insert Update Delete using stored procedures in LINQ to SQL

Показать описание
Text version of the video
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
Slides
LINQ to SQL Tutorial - All Text Articles & Slides
LINQ to SQL Tutorial Playlist
Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
In this video, we will discuss using stored procedures to perform Insert Update and Delete. This is continuation to Part 4. Please watch Part 4 before proceeding.
Step 1 : Create Insert, Update and Delete stored procedures
Step 2 : In Visual Studio, click on the "View" menu and select "Server Explorer". Right click on "Data Connection" and select "Refresh". Expand "Stored Procedures" folder. Here you should find all the stored procedures.
Step 3 : Drag Insert, Update and Delete stored procedures from the Server Explorer window and drop it on the LINQ to SQL class designer. This will automatically create respective methods with the same name as the stored procedures.
Step 4 : Mapping stored procedures to work with LINQ to SQL
a) Right click on Employee entity on LINQ to SQL designer and select "Configure Behavior" option.
b) In the "Configure Bevior" window, set
Class = Employee
Behavior = Insert
Select "Customize" radio button
From the DropDownList, select InsertEmployee() stored procedure
Map Method Arguments to Class properties
c) Finally click OK
d) In a similar fashion, configure stored prcoedures for Update and Delete operations.
At this point, run SQL profiler and start a new trace. Run the application and perform Insert, Update and Delete. In the SQL profiler trace notice that the respective stored procedures are called as expected.
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
Slides
LINQ to SQL Tutorial - All Text Articles & Slides
LINQ to SQL Tutorial Playlist
Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
In this video, we will discuss using stored procedures to perform Insert Update and Delete. This is continuation to Part 4. Please watch Part 4 before proceeding.
Step 1 : Create Insert, Update and Delete stored procedures
Step 2 : In Visual Studio, click on the "View" menu and select "Server Explorer". Right click on "Data Connection" and select "Refresh". Expand "Stored Procedures" folder. Here you should find all the stored procedures.
Step 3 : Drag Insert, Update and Delete stored procedures from the Server Explorer window and drop it on the LINQ to SQL class designer. This will automatically create respective methods with the same name as the stored procedures.
Step 4 : Mapping stored procedures to work with LINQ to SQL
a) Right click on Employee entity on LINQ to SQL designer and select "Configure Behavior" option.
b) In the "Configure Bevior" window, set
Class = Employee
Behavior = Insert
Select "Customize" radio button
From the DropDownList, select InsertEmployee() stored procedure
Map Method Arguments to Class properties
c) Finally click OK
d) In a similar fashion, configure stored prcoedures for Update and Delete operations.
At this point, run SQL profiler and start a new trace. Run the application and perform Insert, Update and Delete. In the SQL profiler trace notice that the respective stored procedures are called as expected.
Комментарии