Data access layer

Using a pluggable provider model, M# simplifies data access operations in the business logic layer through a high level Facade class.

By default, NHibernate is used for relational data mapping while other data access frameworks are supported. LINQ queries and lambda expressions are used throughout the business logic layer to provide exceptionally clean, maintainable and robust data access mechanism.

Support for flexible physical database

The framework of the generated Code by M# supports any relational database including SQL Server, MySQL, Oracle, etc, thanks to its Object Relational Mapping model. In addition it is fully configurable to work on one or many databases and supports any combination of linking the business entities to database instances or tables. So it can fit in any legacy or existing environments seamlessly.

Data Access Diagram

Accessing Database in a very intuitive way

M# Framework gives you access to a Database class. By using its static members you will have a full control over necessary CRUD (Create, Read, Update and Delete) operations without any need to think about the tables and physical structure of data. As an example the following line:



Reads all instances of User from database and you can access each one of them immediately like this:

var users = Database.GetList<User>();



If you need to get only a subset of the users from database you can use LINQ and specify a criteria (which behind the scene will be translated to SQL’s WHERE clause):



To remove instances from database you can use Database.Delete():

var users = Database.GetList<User>(u => u.IsLockedDown);



To add an instance to the database you can simply use Save() method:

var user = new User { Email = "", Password = "loremipsum" };



For update you can either use same Save method or use Update to be more explicit:

Database.Update(user, u => u.Password = "reset");



« Back