The Cached Xml Data Mapper is a a simple xml based ORM.
It converts DataReader, DataTable to custom DTOs / POCOs / objects and vice versa.
Unlike ORMs which are difficult to choose from, complex to understand and that leaves a heavy memory footprint, this one is simple and lightweight.
This mapper makes it effortless to map then transform / convert database query results to your business entities / DTOs / POCOs
The source code and assembly targets .NET version 2.0 and above.
The project is developed in c# using Visual Studio 2005, this has been in use since 2007. NEW: Also provided implementation example / sample project as a console application - Check downloads NEW 2: Provided 4 simple steps to get XmlDataMapper working in the Documentation tab.
MS Caching Application Block : Since the mapping information had to be cached, the best source of caching available across both Windows Application/Service and Web application was Microsoft Enterprise Library - Caching Application Block.
Of course an ORM does much more than just mapping, this implementation has the below listed features:
- Provisions object properties / schema to be defined via XML file
- Converts DataReader, DataSet, DataTable to objects / DTOs / POCOs / Business Entities
- Converts DTOs / Business Entities to DataTables and DataSets
- Uses Microsoft Enterprise Library Cachiing Application block to cache the object schema read from the XML file.
- Uses generics to leverage intuitive and terse conversion which in turn assists self documenting auto completion in visual studio.
- Provides BaseDataHelper class that assists in CRUD operations, in fact it makes writing CRUD effortless
- Works with all databases supported by ADO.NET (Sql Server, Oracle, MySql, Sql Lite, Sybase etc - All versions of these databases as well)
- Is the exact pattern as defined by Martin Fowler's : DataMapper
Implementations supported / Works with the following types of applications
- Any .NET Language (e,g C#, VB.NET, JScript.NET, F# etc)
- Console Applications (Command Line)
- Windows Applications (Windows Forms)
- Web Applications (ASP.NET Web Forms and ASP.NET MVC)
- Windows Service
- Windows Communication Foundation Service (WCF)
- Windows Presentation Foundation (WPF)
Four simple steps to implement XmlDataMapper (Check sample project or the documentation tab above for illustration)
- Create a Business Entity / DTO / POCO for the tables
- Create an XML File with the mapping information between the table and the POCO.
- Specify the POCO and xml file in the configuration.
- Just call the DTOConverter<DTOName>.Convert(dataReader) and other such methods to convert your database record to POCO / DTO / Business Entity
Please note that XmlDataeMapper is LGPL licensed, this means you should keep the copyright notices if you modify the code and reuse this in your applications.coming soon
Sample working implementation of CRUD functionality with Db scripts
Layered sample instead of the folder based segregation of BLL/DAL/DTO/Presentation given in the ConsoleClient (ref: downloads section)