This project is read-only.
Project Description
A simple framework for building sql statements in an object oriented way, executing sql statements with database independency and providing simple object persistence.

This framework is created with four main goals in mind:
  1. Create sql queries in an object oriented way.
  2. Create sql queries with independence of the database dialect used.
  3. Execute queries with independence of the database used.
  4. Create a simple implementation of the ActiveRecord pattern with a lot of flexibility to mix simple save/update/load objects with common sql queries.

Main components
  • QueryFramework - Configures QueryFramework.
  • QueryBuilder - Helps you build sql quieries in an object oriented way that will work in any database.
  • QueryExecutor - Gives you a layer of abstraction to execute queries against any database.
  • QueryObjects - A simple implementation of the ActiveRecord pattern but with a lot of flexibility.

Where to go from here
What can you do with the QueryFramework?

Here are some simple examples using QueryFramework, please visite Examples for more code snippets.

QueryBuilder example
Here is a simple example of what you can do with QueryBuilder:

SelectBuilder sb = new SelectBuilder();
sb.From.TableName = "Articles";
sb.Where.Filters.Add("Active = 1");



SELECT ArticleId,Name FROM [Articles] WHERE (Active = 1)

Visit QueryBuilder Examples to see more advanced uses of QueryBuilder.

QueryExecutor example
Here is a simple example of what you can do with QueryExecutor:

DataTable articles = Database.ExecuteDataTable(connectionString, CommandType.Text, "SELECT * FROM Articles");

QueryObject example
Here is a simple example of what you can do with QueryObjects:

First you have to decorate class to persist with some attributes.

public class Referee : ActiveRecordBase<Referee>
    private String code;
    private String name;

    public Referee() : base()

    public Referee(Session session)
        : base(session)

    public String Code
        get { return code; }
        set { code = value; }

    public String Name
        get { return name; }
        set { name = value; }

Then you can load, save and update it

Referee savedReferee = new Referee();
savedReferee.Code = "REF";
savedReferee.Name = "Referee REF";

Referee loadedReferee = new Referee();            
loadedReferee .Load("XXX");


Referee REF

All contributions are welcome, specially fixing bugs, documenting, adding support for new databases and suggesting new features.

Last edited Jun 14, 2011 at 4:01 PM by mcliment, version 23