concept approach in category .net

appears as: approach, pproaches, pproach, The approaches, n approach
NHibernate in Action

This is an excerpt from Manning's book NHibernate in Action.

.NET offers many tools and choices when it comes to making applications work with SQL databases. You might lean on the Visual Studio IDE, taking advantage of its drag-and-drop capabilities: in a series of mouse clicks, you can create database connections, execute queries, and display editable data onscreen. We think this approach is great for simple applications, but the approach doesn’t scale well for larger, more complex applications.

Alternatively, you can use SqlCommand objects and manually write and execute SQL to build DataSets. Doing so can quickly become tedious; you want to work at a slightly higher level of abstraction so you can focus on solving business problems rather than worrying about data access concerns. If you’re interested in learning more about the wide range of tried and tested approaches to data access, then consider reading Martin Fowler’s Patterns of Enterprise Application Architecture [Fowler 2003], which explains many techniques in depth.

Of all the options, the approach we take is to write classes—or business entities—that can be loaded to and saved from the database. Unlike DataSets, these classes aren’t designed to mirror the structure of a relational database (such as rows and columns). Instead, they’re concerned with solving the business problem at hand. Together, such classes typically represent the object-oriented domain model.

Your applications may do lots of things during a single web request—they render web pages, load data in the persistence layer, carry out business functions, and so on. In the approach we’ll describe, you can use the same single session throughout the entire request. This session is opened at the start of the request and closed at the end. This approach provides several benefits: any un-initialized associations or collections are successfully initialized when accessed at any point during the request, and a session is always available for saving and loading entities. Furthermore, entities aren’t detached during the request as their session is not closed.