This project is read-only.

Custom Stored Procedures

Custom stored procedures can be used to perform custom tasks not natively supported by the framework. You can define a set of returned columns and inputed parameters. You also define a SQL statement. There is no validation against stored procedures. A database stored procedure is defined and a generated code object is created that corresponds to your column definition. This generated object returns an IEnumerable with the objects based on your defined parameters.

This is an example of a customer stored procedure names SalesByYear from the Northwind database. It takes in two dates and returns a list of objects of a type defined in the model.

using (var context = new NorthwindEntities())
{
	var list = context.SalesbyYear(DateTime.Now, DateTime.Now);
}

Last edited May 7, 2012 at 11:51 PM by codetools, version 3

Comments

No comments yet.