SlideShare a Scribd company logo
1 of 16
ORM in C#
                             Using Visual Paradigm




By : Imal Hasaranga Perera
Agenda


What is ORM?
Introduction to VP
Using VP to Generate RDB
Generating C# .NET Persistent Library
Demo of how to use Persistent library
Q&A
What is ORM ???

Object Relational Mapping, A way of getting object-oriented
languages and relational databases to work together
     Object world                        Relational world


           User
   Stu                     Mapping

               A…
     B..
The Object-Relational Impedance
              Mismatch

'Object-Relational Impedance Mismatch' is just a fancy way of
saying that object models and relational models do not work
very well together. RDBMSs represent data in a tabular
format , whereas object-oriented languages, such as Java, C#
represent it as an interconnected graph of objects. Loading
and storing graphs of objects using a tabular relational
database exposes us to 5 mismatch problems
The Object-Relational Impedance
           Mismatch


         1) Granularity

         2) Inheritance

         3) Identity

         4) Associations

         5) Data Types
1. Granularity

Sometimes you will have an object model which has more classes
than the number of corresponding tables in the database

 public class Teacher{


 }

 public class School{

 }
2. Inheritance

Inheritance is a natural paradigm in object-oriented
programming languages. However, RDBMSs do not define
anything similar to Inheritance

              User_main

                                            Inheritance
    Student               Teacher
3. Identity

A RDBMS defines exactly one notion of 'sameness'


                           Teacher_id = 2233

   Thread 1   Teacher




   Thread 2   Teacher
4. Associations

Associations are represented as unidirectional references in
Object Oriented languages whereas RDBMSs use the notion of
foreign keys. If you need bidirectional relationships in C#, you
must define the association twice
          Class user_main {

          Teacher teacher;

          }

          Class Teacher {

          }
5. Data Types

When we consider about data types there a mismatches,
simply String might have limited size than a varchar data type



              String                   Varchar(150)

Mismatches Between Date and time in the object world and
the relational world
Reason for using ORM??


Speeds-up Development - eliminates the need for repetitive
SQL code.
Reduces Development Time.
Reduces Development Costs. User nuser = UserFactory.createUser();
Overcomes vendor specific SQL differences - the ORM
                              nuser.Fname = t1.Text;
knows how to write vendor specific SQLt2.Text; don't have
                              nuser.Lname =
                                              so you
                              nuser.Type = t3.Text;
to.                           nuser.Save();
Rich query capability. ORM tools provide an object oriented
                              t.commit();
query language.
Lets Get Started With
   Visual Paradigm
Relational database

Example ER Diagram Created by Using VP
Code Generating Process in VP




                    Generate C# project
                    using Visual paradigm
Thank You

More Related Content

Similar to Orm in c#

Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
Joe Jacob
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
Rikki Wright
 
Introduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayambaIntroduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayamba
Prageeth Sandakalum
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
Jim Jones
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
webuploader
 

Similar to Orm in c# (20)

ORM Methodology
ORM MethodologyORM Methodology
ORM Methodology
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
 
Java in Biology by Uttara Bidwaikar in Research in Medical & Engineering Scie...
Java in Biology by Uttara Bidwaikar in Research in Medical & Engineering Scie...Java in Biology by Uttara Bidwaikar in Research in Medical & Engineering Scie...
Java in Biology by Uttara Bidwaikar in Research in Medical & Engineering Scie...
 
OODBMSvsORDBMSppt.pptx
OODBMSvsORDBMSppt.pptxOODBMSvsORDBMSppt.pptx
OODBMSvsORDBMSppt.pptx
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
 
ADBMS Object and Object Relational Databases
ADBMS  Object  and Object Relational Databases ADBMS  Object  and Object Relational Databases
ADBMS Object and Object Relational Databases
 
Oodb
OodbOodb
Oodb
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggets
 
oodb.ppt
oodb.pptoodb.ppt
oodb.ppt
 
A02620109
A02620109A02620109
A02620109
 
International Journal of Engineering and Science Invention (IJESI)
International Journal of Engineering and Science Invention (IJESI)International Journal of Engineering and Science Invention (IJESI)
International Journal of Engineering and Science Invention (IJESI)
 
A02620109
A02620109A02620109
A02620109
 
Neo4jrb
Neo4jrbNeo4jrb
Neo4jrb
 
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ NizampetHibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ Nizampet
 
Introduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayambaIntroduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayamba
 
C sharp
C sharpC sharp
C sharp
 
Workin ontherailsroad
Workin ontherailsroadWorkin ontherailsroad
Workin ontherailsroad
 
WorkinOnTheRailsRoad
WorkinOnTheRailsRoadWorkinOnTheRailsRoad
WorkinOnTheRailsRoad
 
Neural Models for Information Retrieval
Neural Models for Information RetrievalNeural Models for Information Retrieval
Neural Models for Information Retrieval
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

Orm in c#

  • 1. ORM in C# Using Visual Paradigm By : Imal Hasaranga Perera
  • 2. Agenda What is ORM? Introduction to VP Using VP to Generate RDB Generating C# .NET Persistent Library Demo of how to use Persistent library Q&A
  • 3. What is ORM ??? Object Relational Mapping, A way of getting object-oriented languages and relational databases to work together Object world Relational world User Stu Mapping A… B..
  • 4. The Object-Relational Impedance Mismatch 'Object-Relational Impedance Mismatch' is just a fancy way of saying that object models and relational models do not work very well together. RDBMSs represent data in a tabular format , whereas object-oriented languages, such as Java, C# represent it as an interconnected graph of objects. Loading and storing graphs of objects using a tabular relational database exposes us to 5 mismatch problems
  • 5. The Object-Relational Impedance Mismatch 1) Granularity 2) Inheritance 3) Identity 4) Associations 5) Data Types
  • 6. 1. Granularity Sometimes you will have an object model which has more classes than the number of corresponding tables in the database public class Teacher{ } public class School{ }
  • 7. 2. Inheritance Inheritance is a natural paradigm in object-oriented programming languages. However, RDBMSs do not define anything similar to Inheritance User_main Inheritance Student Teacher
  • 8. 3. Identity A RDBMS defines exactly one notion of 'sameness' Teacher_id = 2233 Thread 1 Teacher Thread 2 Teacher
  • 9. 4. Associations Associations are represented as unidirectional references in Object Oriented languages whereas RDBMSs use the notion of foreign keys. If you need bidirectional relationships in C#, you must define the association twice Class user_main { Teacher teacher; } Class Teacher { }
  • 10. 5. Data Types When we consider about data types there a mismatches, simply String might have limited size than a varchar data type String Varchar(150) Mismatches Between Date and time in the object world and the relational world
  • 11. Reason for using ORM?? Speeds-up Development - eliminates the need for repetitive SQL code. Reduces Development Time. Reduces Development Costs. User nuser = UserFactory.createUser(); Overcomes vendor specific SQL differences - the ORM nuser.Fname = t1.Text; knows how to write vendor specific SQLt2.Text; don't have nuser.Lname = so you nuser.Type = t3.Text; to. nuser.Save(); Rich query capability. ORM tools provide an object oriented t.commit(); query language.
  • 12. Lets Get Started With Visual Paradigm
  • 13. Relational database Example ER Diagram Created by Using VP
  • 14. Code Generating Process in VP Generate C# project using Visual paradigm
  • 15.