This video demonstrates how to create a Persist mapping to update a table using the Orasis Mapping Studio’s persist mapping and data access code generation mechanism.

Once the code is generated from the Studio and the assembly is successfully built, it can be invoked using the following test method:

 	
/// <summary>       
/// Call the Orasis Generated Update Method to Update the Product table        
/// </summary>        
public void UpdateProduct()        
{            
	IList<ProductUpdater> productUpdateList = new List<ProductUpdater>();            
	OrasisSoftware.Sample.DataAccess.DataAccessService dal = new OrasisSoftware.Sample.DataAccess.DataAccessService();            
	ProductUpdater product1 = new ProductUpdater();            
	product1.productid = 1;            
	product1.QuantityPerUnit = "12 - 14 mg";            
	product1.UnitPrice = 20;            
	product1.UnitsInStock = 1;            	
	product1.UnitsOnOrder = 10;            	
	productUpdateList.Add(product1);            

	int rowsAffected = dal.UpdateProductById(productUpdateList);        
}
 

This concludes creating a Persist mapping and generating code to perform an update on a table. The same can be done for Inserting and Deleting by creating a Persist mapping and choosing the right query type.

1 Comments