This project is read-only.

LLS.Core - A simple ORM Framework


  • Mar 10th: Stable version 1.0 is out on CodePlex.
  • Mar 05th: The first stable version (0.9) of LLS.Core is out on CodePlex.

Project description

A simple ORM Framework with the power to load, save, update, delete and count data in a database. Uses reflection to execute SQL commands on a database and adopts the three-tier architecture to make the code cleaner and easier maintenance.


LLS.Core was created for the purpose of abstracting the data access and make loading and recording data simple and intuitive through the use of reflection to create the SQL commands. Created from a three-tier architecture, using generics and providing basic classes for business logic and data access, LLS.Core becomes a small but powerful ORM framework for small projects.


  • Supports databases with Identity column type (SQL Server, MySQL)
  • Use reflection to generate the SQL commands to select, insert, update and delete data.
  • Provides means to filter data and orders them via SQL without having to load all data to memory for further filtration
  • All result sets are mapped to a data model or list of data model
  • Provides means for executing stored procedures but your return must be mapped manually
  • Use of parameters to prevent SQL Injection
  • Transactions
  • Simple architecture for adding new data providers
  • Use caching mechanism to minimize processing expense in the reflection

Code samples

The code examples below show the basic features provided by LLS.Core.

Import the namespaces
using LLS.BusinessLogic.Core;
using LLS.DataModel.Core;

Configure .config file
  • The key DATA.CONNECTIONSTRING represents the connection string to the database
  • The key DATA.RECORDAUDIT determines whether the audit will be done in the commands of insert, update and delete
  • The key DATA.PROVIDER determines the data provider used to communicate with the database
    <add key="DATA.CONNECTIONSTRING" value="Data Source=localhost;
              Initial Catalog=LLSCore;User Id=LLSCore;Password=LLSCore" />
    <add key="DATA.RECORDAUDIT" value="false"/>
    <add key="DATA.PROVIDER" value="System.Data.SqlClient" />

Create the data model class
[TableAttribute(Name = "Users")]
public class DMOUser : DMOBase
  #region Enumerators

  public enum UserType
    Common = 1,
    AccessGroup = 2,
    Administrator = 3


  #region Properties

  [ColumnAttribute(Name = "UserId", Type = DbType.Int64, Size = 8, PrimaryKey = true)]
  public Int64? Id { get; set; }

  [ColumnAttribute(Name = "Name", Type = DbType.String, Size = 50)]
  public string Name { get; set; }

  [ColumnAttribute(Name = "LastName", Type = DbType.String, Size = 50)]
  public string LastName { get; set; }

  [ColumnAttribute(Name = "Email", Type = DbType.String, Size = 100)]
  public string Email { get; set; }

  [ColumnAttribute(Name = "Account", Type = DbType.String, Size = 20)]
  public string Account { get; set; }

  [ColumnAttribute(Name = "Password", Type = DbType.String, Size = 20)]
  public string Password { get; set; }

  [ColumnAttribute(Name = "Active", Type = DbType.Boolean, Size = 1)]
  public bool? Active { get; set; }

  [ColumnAttribute(Name = "GroupId", Type = DbType.Int64, Size = 8)]
  public Int64? GroupId { get; set; }

  [ColumnAttribute(Name = "CreationDate", Type = DbType.DateTime, Size = 8)]
  public DateTime? CreationDate { get; set; }

  [ColumnAttribute(Name = "CreationUser", Type = DbType.String, Size = 20)]
  public string CreationUser { get; set; }

  [ColumnAttribute(Name = "ModificationDate", Type = DbType.DateTime, Size = 8)]
  public DateTime? ModificationDate { get; set; }

  [ColumnAttribute(Name = "ModificationUser", Type = DbType.String, Size = 20)]
  public string ModificationUser { get; set; }

  [ColumnAttribute(Name = "UserType", Type = DbType.Int32, Size = 4)]
  public UserType? Type { get; set; }


Create the data model object and the business object
  • The string passed to the constructor of the class BOGeneric represents the user that will be used in the recording of audit tables.
DMOUser dMOUser = new DMOUser();
BOGeneric<DMOUser> bOUser = new BOGeneric<DMOUser>("USERNAME");

Get data using EqualTo command
List<DMOUser> users = bOUser.Load(new Filter<DMOUser>().Equal("Name", "Leonardo"));

Get data using Like command and ordering them
List<DMOUser> users = bOUser.Load(new Filter<DMOUser>().Like("Name",
  PositionType.Left, "Leonardo").OrderBy(new OrderByProperty("Id",

Get all data without filter and order
List<DMOUser> users = bOUser.LoadAll();

Get paged data
  • 0 - The startRowIndex number
  • 10 - The maximumRows per select
List<DMOUser> users = bOUser.Load(new Filter<DMOUser>().Equal("Name",
  "Leonardo").OrderBy(new OrderByProperty("Id", OrderType.Descending)), 0, 10);

Insert new data

Update data

Delete data with filter
bOUser.Delete(new Filter<DMOUser>().Equal("Name", "Leonardo"));

Delete data without filter

New examples and complete documentation will be added in the future.

Last edited Mar 10, 2012 at 5:32 PM by llsique, version 14