Project Description
Provide strong type and fluent API to create an XML mapping source for ALinq and Linq to SQL framework.

Features
  • Proide fluent and strong API to create a mapping source.
  • Support inheritance and association mapping (Function mapping is not supported now).

Examples
class NorthwindMappingSource : FluentMappingSource
{
    public NorthwindMappingSource(Action<DatabaseMapping<NorthwindDatabase>> func = null)
    {
        Map<NorthwindDatabase>(mapping =>
        {
            mapping.ProviderType = typeof(AccessDbProvider);
            mapping.Table(o => o.Categories, CategoryTableName)
                    .PrimaryKey(o => o.CategoryID)
                    .Column(o => o.CategoryName)
                    .Column(o => o.Description)
                    .Column(o => o.Picture)
                    .Association(o => o.Products, o => o.CategoryID, o => o.CategoryID);

            mapping.Table(o => o.Products, ProdcutTableName)
                    .PrimaryKey(o => o.ProductID)
                    .Column(o => o.ProductName)
                    .Column(o => o.CategoryID)
                    .Association(o => o.Category, o => o.CategoryID, o => o.CategoryID);

            if (func != null)
                func(mapping);
        });
    }
}

Last edited Apr 17, 2013 at 10:19 AM by ansiboy, version 5