What are the session interfaces

Building on the details in Introduction to the ISession, I wanted to explain the different interfaces in MicroLite for the Session.

Firstly we have the ISession interface itself:

This interface provides methods for dealing with instances of mapped entities such as insert, update, select (via Single or Fetch) & delete. It is the main interface you will use for data access when developing an application which uses MicroLite.

The ISession provides an advanced property:

This interface provides methods for performing SQL actions which are not related to entity instances. The reason for encapsulating these methods behind a separate interface is to keep the main ISession API simple.

Introduced in MicroLite 2.0, ISession also exposes an include property which provides methods for the retrieval of associated objects when performing queries in a single database call.

Although these methods could have been provided as ISession.IncludeSingle() for example, the property encapsulates the behaviour in a single place, providing a number of new methods with only a single addition to the main ISession interface. This helps keep the ISession API small and allows the code to read well.

This article was written for version 2.0.0 of the MicroLite framework.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s