This project is read-only.
Getting Started

1. Introduction and configuration
2. Designer Features
3. Mapping Entity (Relationship, Fields, Keys, Composite Keys) etc
4. Querying Entitiy.
5. Inheritance and Super mappings
6. Life Cycles (Events, Exception handling)
Welcome to the new innovative Object Oriented Relational Mapping. If you happen to be on this page at this time, you have chosen to be a Rapid application developer leveraging todays and tomorrows technology. For those of you who do not have an idea on ORM, not to worry, i will cover everything you need to become an expert in using ORM.

What is Rapid Entity Framework?

Rapid entity framework is a motivation and also an initiative that needs to bridge the divide between our object oriented semantics and relational data. There are semantic differences in using an OO and RDBMS, so when we write an application targeting an Relational Database, we would want to convert the data from relational database into object which the OOP platform is more familiar. We do this for each project that we work on. Its has become a more apparent situation when we tend to loose all time because the approach slows down our development efforts. Now, Repetitive programming is one of those things that we found very boring in our daily activities. To save time and delve into real business cases of a project, we would prefer to use a domain driven approach that will automate the repeated aspect of our daily challenges as a developer.

Now using the following schema, (The Good old Customer table of Northwind database) :


Also using the Customer Entity derieved from the aboved schema

    public class Customer
        public string Companyname {get; set;}
        public string Contactname { get; set; }
        public string Contacttitle { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string Region { get; set; }
        public string Postalcode { get; set; }
        public string Country { get; set; }
        public string Phone { get; set; }
        public string Fax { get; set; }
        public string Customerid { get; set; } 

The bad old days

I would like to take you back to the past when we used to Read next row in a datareader object to fetch the approapriate ro or column. This stage of data to object mapping is what a newbie will appreciate when embarking on the journey in .NET land. An example of this approach is as follows using the schema and Customer class above.

            IList<Customer> customers = new List<Customer>();

            IDbConnection connection = new SqlConnection("Connetion string");
            IDbCommand command = connection.CreateCommand();
            command.CommandText = " SELECT c.* FROM Customers  c";
            command.CommandType = CommandType.Text;

            IDataReader dataReader = command.ExecuteReader();

            while( dataReader.Read() )
                Customer customer = new Customer();
                customer.Companyname = ( string ) dataReader["Companyname"];
                customer.Contactname = ( string ) dataReader["contactdetail"];
                customer.Contacttitle = ( string ) dataReader["contactdetail"];

                customers.Add( customer );

This approach is fine, but the down side is repeated coding, sql injection attacks, tight coupling your sql code inside your business aware components. It is laborious, does not have query support, you cannot use fundamental OOP strategies with this approach, customer cannot inherit from person class because we are acting upon data reader directly.

Now The futureORM

The future is so simple and if you are lucky enough you tend to get the following sweet things for free :
  1. A code generator
  2. A domain designer integrated right into your IDE
  3. Code first development (You can start with code before generating sql scripts from your entities)
  4. lazy loading
  5. Strong emphases on OOP (Inheritance, abstraction, encapsulation etc )
  6. Cascading
  7. You get back object not datareader
  8. Linq integration

and many more ....

Last edited Mar 21, 2011 at 1:03 PM by ahmedsalako, version 31


No comments yet.