Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Easy Data Object Relational Mapping Tool


Published on

ORM Solution for MS .NET which supports MSSQL, MySQL and Oracle databases

  • Be the first to comment

  • Be the first to like this

Easy Data Object Relational Mapping Tool

  1. 1. EasyDataDeveloper Friendly Object-RelationalMapping Tool for Microsoft .NETHasitha Guruge2008/MCS/021
  2. 2. IntroductionWhat is “EasyData”? • “EasyData” is an open source, developer friendly Object-relational mapping tool for Microsoft .NET which has been developed based on C#.NET language. It enables developers to use it with databases such as MS SQL, MySQL and Oracle. Your Logo
  3. 3. Objectives Primary Objectives✓ 1 Develop an object-relational mapping tool with basic functionalities✓ 2 Support for Microsoft .NET Web/Windows Applications✓ 3 Ability to use inheritance and polymorphism and create hierarchies between entities✓ 4 Handle relationships such as 1-1, 1-n, n-1 and n-n✓ 5 Support for transaction based data operations 6 Support for Aggregations and SQL Grouping Secondary Objectives✓ 1 Support for multiple Databases (MS SQL, MySQL, Oracle) 2 Has its own Query Language (OQL)✓ 3 Support for Data Binding of components in .NET✓ 4 Easy configuration and relatively low learning curve Your Logo
  4. 4. DAL & ORMCore concepts behind the project • In Applications Data Access Layer is the layer which deals with data. • Object-Relational Mapping is one way to automate this DAL by reducing redundant work and higher risk of errors. • ORM Tools create a bidirectional link between relational database and objects in an application.
  5. 5. Related Projects Major tools based for the project - Open Source NHibernate - Complex Configuration - Huge Learning Curve - Mapped via XMLs - Multiple Database Support - Open Source Fluent - Extension to NHibernate NHibernate - Mapped without XMLs / Separate Mapping Layer - Complex Configuration - Huge Learning Curve - Open Source - Use Active Record Design PatternCastle Project - Based on NHibernateActiveRecord - Mapped without XMLs via same Entity Object - Since it is based on NHibernate, same disadvantages exist here as well Your Logo
  6. 6. Related ProjectsMicrosoft or Private Projects LINQ to SQL LINQ to SQL and ADO.NET Entity Framework Only with .NET Framework 3.5 or have their own limitations such as lack of 1 higher. DBML file provides the mapping functionality. support for MySQL and no support for the lower versions such as Framework 1.1, 2.0 likewise. ADO.NET Entity Framework nHydrate was a private project till Sep, 2009 Only with .NET Framework 3.5 or 2 higher. Uses Active Record pattern. and built on .NET Framework 3.5 to work exclusively with MS SQL Server. nHydrate Studied related work and extracted the important features to incorporate with EasyData. Uses Active Record Pattern in core 3 of DAL. Since it was a private project it is not so popular. Your Logo
  7. 7. ER Diagram to perform testing
  8. 8. EasyData DesignComponent Diagram – with extended features
  9. 9. ImplementationImplementation Process With Extended R & D Existing Features Tools With Basic Features Your Logo
  10. 10. How It Looks LikeSample Insert Method with Testing[Test]public void SimpleCreateTest(){ using (EasySession easySession = new EasySession()) { ///[Test Create] - without relationship ProductCategory productCategory = new ProductCategory(); int resultCount = productCategory.Count(easySession); Assert.AreEqual(4, resultCount); productCategory.Name = "Test Category"; productCategory.Rowguid = Guid.NewGuid(); productCategory.ModifiedDate = DateTime.Now; productCategory.Save(easySession); resultCount = productCategory.Count(easySession); Assert.AreEqual(5, resultCount); }} This is a sample code to tests the Save() functionality. The “ProductCategory” is a sample table that has many Sub Categories under that. The “easySession” responsible for the database connection and the transaction of the record insert. All executions within one session is handled under the same transaction. Simply create an instance of the object and assign values to the instance and simply call Save() function. Your Logo
  11. 11. EasyData HierarchyHow the components interact with each other? Code Behind Files public class ProductCategory Code Behind Files (aspx.cs or aspx.vb) { public class ProductCategory Code Behind Files (aspx.cs or aspx.vb) } { public class ProductCategory Configuration File (aspx.cs or aspx.vb) } { } public abstract class EasyDataBase<T> public class EasySession : IDisposable { { …………. …………. ……………. ……………. } } Object Query Classes public class EasySave<T> public class EasyUpdate<T> public class EasyDelete<T> public class EasySelect<T> { { { { …………. …………. …………. …………. ……………. ……………. ……………. ……………. } } } } DB Specific Library - MS SQL Custom Attributes - MySQL Database - Oracle
  12. 12. Scope of the ProjectInitial Scope Conduct a literature survey on existing and popular ORM tools which are used in .NET Framework and understand 1 their architectures , basic operations and features Implement a mapping tool with basic features such as CRUD operations with the support of relationships among 2 tables/entity objects Enhance the tool with new effective and flexible features as a separate R & D task 3 Test the tool using a sample common database or generated data from another mapping tool 4 Release the functional tool as a beta version to use with the developments of target users’ 5 Conduct a survey to collect and identify developer needs and feedbacks 6 Your Logo
  13. 13. Scope of the ProjectDeviations from the Initial Unable to go through the all features and functionalities of all popular tools due to their complexity and time 1 constraints Unable to build in-built functionalities to support all aggregation and grouping functions due to the time constraints 2 R & D Phase was dragged more than expected, due to the complexity and huge learning curves of existing tools 3 Unable to deliver the beta version on time and let it be tested by the target users, currently it is available for the 4 target users for testing The final survey is not conducted, since the developments were delayed and release of the beta version without 5 enough time to perform the testing by target users Unable to complete the OQL (Object Query Language) and its functionalities and is currently available as a basic 6 version towards that Your Logo
  14. 14. ConclusionThe final result The beta version of the implemented tool is available on Since it is an open source tool the windows binaries as well as the source is available online. A survey to collect developers’ expectations and experience with another popular tools is provided before download of the tool. Your Logo
  15. 15. Future EnhancementsSteps towards a stable & rich tool Implement object query language (OQL) as it is in an integrated query language (LINQ) 1 Implement more in-built functionalities to provide more flexibility in data selection 2 Build a standalone tool or integrated tools to generate entity class files with mapping related details by reading the 3 database tables and relationships Optimize the auto generated queries and the process of building queries to improve the performance of the tools 4 Implement a parameterized way to call functions which contains strongly typed variables for the different database 5 types instead of implementing the same method repetitively by checking the database type Implement a good library for different query languages which contains keywords, reserved words and special 6 scenarios for those languages to handle scenarios such as following SELECT TOP example. SELECT * FROM parts WHERE name = gearbox LIMIT 1; -- MySQL or PostgreSQL SELECT * FROM parts WHERE name = gearbox AND rownum < 2; -- Oracle SELECT TOP 1 * FROM parts WHERE name = gearbox; -- Microsoft SQL Server Your Logo
  16. 16. THANK YOU! Your Logo