Documentation of free .NET O/R Mapper - Code Generator Invist

The use of stored procedures is very simple. Based on the Command in .NET Framework the generated stored procedures are strong typed. For each Parameter exists a Property. You don't need to know the exact Name of the Parameters. Use the intellicense of your IDE.

Edit

Stored Procedure

The following examples demonstrates the use of the 'Sales by Year' stored procedure in the Northwind-Database. In Designer of Invist the name is defined as 'SalesByYear'.

SalesByYearCommand procedure = new SalesByYearCommand();
procedure.Beginning_Date = new DateTime( 1980, 1, 1 );
procedure.Ending_Date = DateTime.Now;

IConnection connection = new Connection();
procedure.Connection = connection;
            
connection.Open();
using( IDataReader reader = procedure.ExecuteReader( CommandBehavior.CloseConnection ) ) {
    // Implement code     
}

As you can see, the use of strongly typed stored procedures is very simple.

Edit

Load Entities with a Stored Procedure

Base on following stored procedure will be demonstrate how to create an Order EntityList

CREATE PROCEDURE [OrderEntries] 

AS
BEGIN
	SET NOCOUNT ON;
    SELECT * FROM dbo.Orders;
END


IConnection connection = new Connection();

OrderEntries categoryEntries = new OrderEntries();
categoryEntries.Connection = connection;

List<Order> orders = new List();
connection.Open();

using( IDataReader reader =  categoryEntries.ExecuteReader( CommandBehavior.CloseConnection ) ) {
    while( reader.Read() ) {
        var order = new Order();
        
        // Assign Data of DataRecord to Entity and set State to unchanged
        ((IEntity)order).AssignData( reader, EntityState.Unchanged );
                    
        // Add Entity to List
        orders.Add( order );
    }
}

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam. Invist is powered by Mirko Meier