Search Wiki:
CSMetal - Code generating/Linq provider sample
CSMetal is a command line tool that reads Commerce Server 2009 metadata and generates a set of strongly-typed classes to use with the Commerce Foundation API and a set of Linq providers to allow access to Commerce Server entities via Linq.
It can dramatically simplify basic access to Commerce Server 2009 functionality by enabling simple Linq-syntax queries against most Commerce Server entities.
Sample unit tests are included that demonstrate the various access methods including a full checkout scenario.

This tool was created by Kerry Havas, Product Architect of the Commerce Server Product Unit.
It is not an official Microsoft release and is not supported by Microsoft Product Support.
Please use the discussion lists here to ask questions and provide feedback.

There are two solutions that are provided as part of this release
CSMetal - This is a solution that generates the strongly-typed classes and LINQ providers. It consists of the following projects:
  1. CSMetalGenerator - This is the class library that emits the strongly typed classes and LINQ contexts.
  2. CSMetal - This is a console application that can be executed to automatically generate the classes.

CSMetalTest - This is a solution that provides a set of unit tests and connectivity classes to allow rapid testing of generated classes. It consists of the following projects.
  1. CSMetalCommerceServerProxy - This is a class library that encapsulates connectivity to Commerce Server 2009.
  2. CSMetalLinqProvider - This is a class library that contains the generated classes and some supporting classes and encapsulates access to the strongly-typed classes and LINQ contexts.
  3. CSMetalTest - This is a Test project which contains tests against the strongly-typed classes and LINQ contexts.

There are also a couple of sample applications, including a rewritten version of the "Orders" sample that comes with Commerce Server, which demonstrates the savings in overall code of using the Linq based queries and even a sample ASP.NET MVC 3 (Razor) application.

Please note that this was developed and tested using the CS20009 VPC available from connect.
It is intended to be unzipped into the following directory: C:\Users\Administrator\Documents\Visual Studio 2010\Projects\CSMetalDev
You may install it elsewhere or use it in your solution environment, but you will need to make modifications to paths, etc.
Please see the readme for directions on changes that would need to be made.

All source code is provided for the code generator and it may be modified to fit your need.

Last edited Oct 21 2010 at 7:30 PM  by KerryHavas, version 18
Page view tracker