Quick Start Tutorials

There are many ways to accomplish object-object mapping (OOM), and object-relational mapping (ORM). From manually coding the mapping routines to using a combination of configurable and/or convention based tools, all approaches are behind the same goals:
  • Copying the properties of a source object to a target object
  • Reading and writing object models to and from relational databases

Although these concepts are very simple, implementations can vary in complexity according to requirements (e.g. shape transformations, property visibility, primitive type conversions, handling of null values, change tracking, etc). What makes each solution unique is the set of objectives and principles behind them, and how they are prioritized. With Knak we are trying to build a tool that is:
  • Simple, intuitive, and based on conventions that tackle most scenarios by default.
  • Almost as efficient as manually coding the mappings.
  • Delivered in very small open source files that can be scrutinized by others.
  • Any scenario in conflict with the above must be the exception and should be solved by other means.

The main idea (btw, this is an old idea) is that if we can define a Default Mapping Convention, then copying objects of different types, cloning objects, or mapping models to relational tables (via SQL scripts) should be an efficient and straightforward proposition.

The Knak solution uses static generic extension methods to compile and cache the mapping routines on demand. The first time a mapping is used, the types are matched following the default conventions and a static type mapper is compiled. The resulting mappings are always available for review at runtime, and some basic customization is also possible in case the user doesn't have full control of the types being mapped.

The source files are small and easy to follow, so you are invited to review them and send questions or suggestions back to us.

Last edited Dec 3, 2012 at 1:28 PM by knak, version 11


No comments yet.