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
Fetch) & delete. It is the main interface you will use for data access when developing an application which uses MicroLite.
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.