[InsertintoCategory]
( @category nvarchar (100) = NULL,
@description nvarchar (100) = NULL
)
AS
INSERT into Categories (CategoryName, Description)
VALUES (@category, @description)
Now expand the server explorer and locate the stored procedure. Drag-and-drop the
stored procedure on the designer surface to create the corresponding DataContext
method. The generated DataContext method would look like this:
[Function(Name="dbo.InsertintoCategory")]
public int InsertintoCategory([Parameter(DbType="NVarChar(100)")]
string category, [Parameter(DbType="NVarChar(100)")] string
description)
{
IExecuteResult result = this.ExecuteMethodCall(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())), category,
description);
return ((int)(result.ReturnValue));
}
Now select the entity object and open Properties of the entity class. Entity class has
properties like Insert, Update, and Delete, as shown in the following screenshot:
Chapter 4
[ 127 ]
In the Properties window, click on the Use Runtime option against Insert property
for the Category entity class.
Pages:
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211