This project is read-only.

Moved to

Project Description
WXML is object mapping format similar to dbml or edmx.

The main idia is to create independent from specific orm xml format to define object mapping. The object model very close to System.Data.Metadata.Edm and System.Data.Entity.Design but much simplier and independent from Worm, ADO.NET EF or any other object mapper.
Originaly was designed for Worm.
Class reference

Generate linq context on the fly

In this example we get the following model without interacting with Visual Studio and manual writing dbml.
So, here is the code with comments
//Create provider for Microsoft SQL Server
MSSQLProvider p = new MSSQLProvider(GetTestDB(), null);

//Create database view contains three tables - ent1, ent2 and 1to2
SourceView sv = p.GetSourceView(null, "ent1,ent2,1to2");

//Create empty model
WXMLModel model = new WXMLModel();

//Create connector between model and database view
SourceToModelConnector c = new SourceToModelConnector(sv, model);

//Apply database view to model
c.ApplySourceViewToModel(false, //drop columns
   relation1to1.Hierarchy, //one to one relations behaviour
   true, //modify database names to readable form
   false //capitalize database names

//At this point we have filled abstract WXMLModel and are going to generate linq context
//Add linq context to model
model.LinqSettings = new LinqSettingsDescriptor()
    ContextName = "TestCtxDataContext"

//Create linq context generator
LinqCodeDomGenerator gen = new LinqCodeDomGenerator(model, new WXML.CodeDom.WXMLCodeDomGeneratorSettings());

//Generate code for linq context and write it to console
You can find all code in TestCompareLinqCtx method of LinqCodeGenTests project.
Here is generated linq context.

Last edited Apr 30 at 11:34 AM by AlexShirshov, version 11