21.2 Mapping Business Objects with NPersist

Someone writing an O/RM framework has many choices to make concerning the approach taken. In some cases, the choice involves a straightforward tradeoff between raw performance and an expanded feature set, while in other cases, there are simply different ways of doing things that can each be desirable in different situations.

Since there’s such a large number of choices to make, there is room for a wide variety of frameworks, all addressing the same basic premise of moving data between the relational database and in-memory objects but accomplishing this task in different ways.

NPersist, one of the frameworks included in Puzzle.NET (see http://www.puzzleframework.com), has a strong bias toward providing runtime object services that aim to keep object graphs consistent and that minimize the amount of code needed for working with objects.

Performance is always an important consideration, and NPersist is full of performance-oriented optimizations. However, in accordance with Sir Charles Antony (“Tony”) Richard Hoare’s observation that “premature optimization is the root of all evil,” NPersist defaults to correctness and availability of features rather than highest possible performance. When it has a choice, NPersist will sacrifice performance in favor of maintaining object-graph consistency or providing richer, productivity-enhancing functionality. Having said that, NPersist does offer a lot of flexibility to optimize performance at the expense ...

Get Windows Developer Power Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.