Skip navigation

ORM in .NET

 

What is ORM?

 

ORM stands for Object Relational Mapping. ORM is used to transparently relate objects to Backend data store.

 

ORM.NET Solution

 

 

Object Population

 

 Let us consider the primary decisions that needs to taken for object population.

 

          Represents internal class data as Dataset

          Create all the properties with their appropriate types

          Perform all translations within properties

          Represents collections as specialized classes

 

Techniques involved in Object Population

 

Built-in features of ADO.NET Dataset /DataAdapter / Command Builder are used

 

Text Box: DataSet ds = new DataSet ();
 
SqlDataAdapter sda = new SqlDataAdapter (command);
 
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder (sda);
 
sda. Fill(ds, tableName);
 

 

 

Object Persistence

 

ADO.NET handles the persistence behind the scenes.

 

 

 

Text Box: Protected void Synchronize ()
 
{
                
 
DataAdapter.Update(ParentDataSet);
                
ParentDataSet.AcceptChanges();
 
 
} 
 
 

 

 

 

 

Issues and Limitations

 

          Database Tables would be retrieved individually

1.       No joins should be used

2.       May degrade retrieval performance

3.       Datarelations may need to be created

 

          Properties returning collections need to be aware of the table relations

 

          Data source transparency is hard to achieve

 

          Specialized collection classes may cause maintenance and support issues

 

          May choose to flatten the database Increases performance / Eliminates the needs for joins

 

Conclusion                                                                                                                              

 

         

Easy to implement and maintain solution.

         

No third-party tools required.

         

Based on out-of-the-box .Net functionality.

         

Plumbing code and base classes are written once.

         

Most data retrieval and persistence code is eliminated.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish