Quantcast
Channel: rapidentityframework Wiki & Documentation Rss Feed
Viewing all articles
Browse latest Browse all 20

Updated Wiki: Home

0
0
My Name is Ahmed Salako
I am seeking team members and project sponsors to contribute rapidly. If you or your company are interested in taking this framework to the next level, you can reach me at the following :
  1. Blog : http://salakoahmed.blogspot.com/
  2. ahmed.salako(a)hotmail.co.uk

Getting Started
Documentation
Latest Addins
Why Rapid Entity Framework
Face of the new Designer
Unique Features of Rapid Entity Framework
Introducing OORM (Object Oriented Relational Mapping)

Open Introductory Video : third.wmv

Rapid News
  1. Rapid is now compliant with VS2010
  2. XML Mapping is here (Rapid now support both attribute and xml based mapping)
  3. We have now improved RQL syntax.
  4. *Composite Foreign Keys is here

codify.PNG

The maturing persistent framework

The Object Oriented Paradigm is shifting massively because coupling relational semantics into our fine grained object oriented programming designs is becoming unpopular in todays enterprise needs and domain engineering. Because of this reasons and many more, object oriented platforms is already taking a big quantum leap since the impedance mismatches between OOP and Relational has made programming against relational database an Herculean task for most development efforts.

The industry is filled with many framework's that contribute to this change, and "Rapid Entity Framework" is one out of many that will solve most of the mismatches that we face in the persistence industry today. Rapid Entity Framework is an open source framework that was discovered by a motivation to really solve the divide problem between relational DB and object oriented concepts.

With rapid entity framework, you can think about your business domain rather than columns and rows. Its a wise design efforts to really segregate applications according to their duties, "what they do", this segregation methodologies applied by industry today, should be applied to database and object (Because they are different concept). A database is data centric, and should only contain data and any data manipulation semantics. While on the other hand, an object oriented architecture see object as real life artifacts.

Introducing Rapid Entity Framework

Rapid Entity Framework is another Object Oriented Relational Mapping framework with full object orientation semantics. It runs on the Microsoft .NET environment and its compliant with the .NET languages (C#, VB.NET). Rapid Entity gives you the benefits of persisting and fetching object states in a relational database system without forcing you to implement or inherit framework classes. I see Rapid Entity as the .NET version of the JAVA PERSISTENT FRAMEWORK So if you are a java developer in .NET Land here is the equivalent of JPA. To start with, let us follow a simple rapid example : with the following assumptions :
  • We have a customer class that is mapped with rapid attributes against our database (Microsoft Access or MS Sql Server).
  • We are using .NET version 2.0 or 3.5

Customer Class Diagram

customerAdressclassdiagram.JPG

The diagram above depicts the structure of the Customer and Address entity classes. There is a one - to - one relationship with both classes, so this will form the basis of our examples. First of all, we need to understand how to persist these entities, so i will be describing the rapid framework classes that we need to do the persistence. The snippet below shows how we can rapidly persist and manipulate an entity (Customer) in our example.



        EntityManager manager = new EntityManager();
        manager.OpenDatabaseSession();

First of all, the code snippet above is to initialize the EnitityManager class, which in this case is our entry - point to the persistent framework. We are initializing the EntityManager class with the instance of the WebConfigurationFactory. The WebConfigurationFactory class is created once in an application lifetime and it serves as the manager for database connections, and connection string. If you want to know how to setup your WebConfigurationFactory class, click Setting up WebConfigurationFactory . Most web applications that targets Rapid Entity Framework will configure the WebConfigurationFactory in their Global.asax (On_Application StartUp) file or class that is registered as HttpModule, while standalon\or console based application will use the ConfigurationFactory, both classes implements IConfigurationFactory interface.


Now let us create a Customer object and fill the fields with values :
        Customer customer = new Customer();
        customer.Country = "United Kingdom";
        customer.FName = "Ahmed";
        customer.LName = "Salako";
        customer.Message = "Hello world";

Above code is the initialization of our customer object. To do next is the initialization of an address class. The Address and Customer class are related by a one -to- one. We will initialize an address object and assign values to it and we will assign the address object to the customer object. such as follows :

        Address address = new Address();
        address.Country = "Nigeria";
        address.Customer = customer;       //You can notice the bi-directional relationship here.
        address.HouseNo = "83";
        address.PostCode = "NE 889";
        address.Street = "Gotham City";

        customer.Address = address;      //You can notice the bi-directional relationship here.

*Key Note : Make all your entity properties virtual, because the API uses ghost objects (Like Dynamic Proxy).

The code snippet above assigns an address object to a customer object. All the two objects are not yet persisted, so we will do the persistence by calling the code below :

        entitymanager.CreateNewEntity(customer);

        entitymanager.CommitAndClose( );

Note that we are calling entityManager.CreateNewEntity(customer); we are creating the customer object which will in turn create the address object because their relationships in the mapping is also Cascade. which means when we make changes to customer, the changes in the address object will also be persisted. If we delete customer, the address object will also be deleted if we set the appropriate cascade options.

Viewing all articles
Browse latest Browse all 20

Latest Images

Trending Articles





Latest Images