SlideShare une entreprise Scribd logo
1  sur  24
Presentation Agenda on nhibernate:




                     By: Shahzad Sarwar
                     To: Development Team
Part 1: 1st Aug 2009 3:30 PM


Part 2: Later
    • Version 2.1 new features
    • Performance tuning
    • Proxing
    • Cache
    • Design pattern for NHibernate
    • Case Specific provider
What is OR Mapping.
OR Mapping Frameworks
Overview of LINQ
Types of LINQ
LINQ 2 SQL
LINQ 2 Entities
Samples for LINQ

What is nHibernate?
A .Net port of Hibernate of Java
Covers: Mapping and Data query format
Hides SQL and ADO.NET.




XML Configuration File
<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">

  <!-- an ISessionFactory instance -->
  <session-factory>
     <!-- properties -->
     <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
     <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
     <property name="connection.connection_string">Server=localhost;initial
catalog=nhibernate;User Id=;Password=</property>
     <property name="show_sql">false</property>
     <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
     <property name="use_outer_join">true</property>

     <!-- mapping files -->
     <mapping resource="NHibernate.Auction.Item.hbm.xml" assembly="NHibernate.Auction" />
     <mapping resource="NHibernate.Auction.Bid.hbm.xml" assembly="NHibernate.Auction" />
  </session-factory>
</hibernate-configuration>




Persistent vs transient Objects
Level of abstraction
Page/Application level scope.
Eg:
   Datetime dt;
   Session/application level vatables
DB Level
Even shutdown of machine
Searlization as file /DB

POCO vs POJO
Samples

Nhibernate Basic
Mapping file - hbm.xml
Entity class

public class Category
  {
     #region Fields
     private int _CategoryID;
     private string _Description;
     #endregion
     #region Constructors
     /// <summary>
     /// Initializes a new instance of the Account class
     /// </summary>
     public Category()
     {
     }
     public Category(int CategoryID, string Description)
     {

       this._CategoryID = CategoryID;
       this._Description = Description;

     }
     #endregion

     #region Properties
     /// <summary>
     /// Gets or sets theCategoryID for the current Category);
     /// </summary>

     public virtual int CategoryID
     {
       get { return _CategoryID; }
       set { _CategoryID = value; }
     }
/// <summary>
    /// Gets or sets theDescription for the current Category);
    /// </summary>

    public virtual string Description
    {
      get { return _Description; }
      set { _Description = value; }
    }

    #endregion

  }
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHDEMO"
namespace="Lib">
<class name="Category" table="Category" dynamic-update="true" optimistic-lock="dirty" >
 <id
         name="CategoryID"
         column="CategoryID">
  <generator class="native"/>
 </id>

<property name="Description" column="Description" type="String" length="250" />

</class>

</hibernate-mapping>


Show samples




Code generation
1. Avva Open source Solution
Get latest copy from
$NHTool.root
See attached Manual.
Introduction

Here is a tool for the use of your own applications that NHibernate. You can easily install and use
this helper kit. To download, please click the link at the top of the page. If you are using
NHibernate, you need to write a lot of persistent classes and XML mapping for each persistent
class. Also, you need to write the NHibernate config file. At this point, using this tool, you can
automatically create all these files in a few seconds.

Using

There are four tab screens on the tool.
1. Connection: This screen allows you to connect your database with connection
   parameters. It looks like the Visual Studio connection wizard. You need to set some
   parameters to connect to your database.




2. Tables & Columns: This screen allows you to browse a selected database's tables and
   select them to create files. Also, if you want, you can see a table's column information by
   selecting from a table from a list and clicking "Preview Columns".
3. Settings: This screen allows you to select some features, for example, copy the
   NHibernate DLL and use dynamic updates. Also, you have to select your project folder to
   configure the folders, namespaces, and assembly names.
4. Generate: At the end of this, we can start the generate process. Just click Run and wait a
    few seconds. You can view all the process details in this section.
After you've successfully completed the generating process, you can see the generated
files in the project folder. If you selected "Copy NHibernate DLL to project" and other
DLLs, the generator will copy it and create an NHibernate config file in your project's "bin"
folder.
Also, the generator creates a folder named App_Code in your project folder to put
        persistent classes and mapping files in. It directly creates persistent classes to
        App_Code, and mapping files creates them in the NHMappings folder, as follows:




Let's check it out how it's looking.

Persistent class
Mapping the XML file
2. NConstruct Lite
Neat Code, but not customizable as it is commercial product
CRUDE Operation Sample
See Sample demo for CRUDE operations.

dynamic-update
dynamic-insert
select-before-update
one-to-one
one-to-many
many-to-one
bag
fetch = join-select for category
HQL
cascade


Nhibernate Analyiser:
1. SQL Server Analyiser
2. nhIbernate Analyiser
3.

Contenu connexe

Tendances

Core Data with multiple managed object contexts
Core Data with multiple managed object contextsCore Data with multiple managed object contexts
Core Data with multiple managed object contextsMatthew Morey
 
Client Server Communication on iOS
Client Server Communication on iOSClient Server Communication on iOS
Client Server Communication on iOSMake School
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate TutorialSyed Shahul
 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shintutorialsruby
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/ServletSunil OS
 
Mule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbMule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbGunjan Deshmukh
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentationsourabh aggarwal
 
JavaScript
JavaScriptJavaScript
JavaScriptSunil OS
 
Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4soelinn
 
Spring 3: What's New
Spring 3: What's NewSpring 3: What's New
Spring 3: What's NewTed Pennings
 
New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)Markus Eisele
 
Create a Core Data Observer in 10mins
Create a Core Data Observer in 10minsCreate a Core Data Observer in 10mins
Create a Core Data Observer in 10minszmcartor
 
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateEffiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateThorben Janssen
 
Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Fwdays
 

Tendances (19)

Core Data with multiple managed object contexts
Core Data with multiple managed object contextsCore Data with multiple managed object contexts
Core Data with multiple managed object contexts
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Client Server Communication on iOS
Client Server Communication on iOSClient Server Communication on iOS
Client Server Communication on iOS
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate Tutorial
 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shin
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
Core Data
Core DataCore Data
Core Data
 
Mule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbMule esb – connecting to ms sql db
Mule esb – connecting to ms sql db
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentation
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4
 
Spring 3: What's New
Spring 3: What's NewSpring 3: What's New
Spring 3: What's New
 
New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)
 
Create a Core Data Observer in 10mins
Create a Core Data Observer in 10minsCreate a Core Data Observer in 10mins
Create a Core Data Observer in 10mins
 
Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5
 
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und HibernateEffiziente Datenpersistierung mit JPA 2.1 und Hibernate
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
 
Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
11-DWR-and-JQuery
11-DWR-and-JQuery11-DWR-and-JQuery
11-DWR-and-JQuery
 

Similaire à OR Mapping- nhibernate Presentation

Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentationguest11106b
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's GuideKeyur Shah
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - TryoutMatthias Noback
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)Woonsan Ko
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Bastian Feder
 
SCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitSCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitMike Pfaff
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)lennartkats
 
maven-for-maine-jug-090226091601-phpapp02.ppt
maven-for-maine-jug-090226091601-phpapp02.pptmaven-for-maine-jug-090226091601-phpapp02.ppt
maven-for-maine-jug-090226091601-phpapp02.pptnikhilmahendranath1
 
Code That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernateCode That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernateDeepak Sahu
 
香港六合彩
香港六合彩香港六合彩
香港六合彩iewsxc
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
 

Similaire à OR Mapping- nhibernate Presentation (20)

Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
GradleFX
GradleFXGradleFX
GradleFX
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
SCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitSCR Annotations for Fun and Profit
SCR Annotations for Fun and Profit
 
Ibm
IbmIbm
Ibm
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
 
Readme
ReadmeReadme
Readme
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
 
maven-for-maine-jug-090226091601-phpapp02.ppt
maven-for-maine-jug-090226091601-phpapp02.pptmaven-for-maine-jug-090226091601-phpapp02.ppt
maven-for-maine-jug-090226091601-phpapp02.ppt
 
Code That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernateCode That Writes Code : Automatic Programming for NHibernate
Code That Writes Code : Automatic Programming for NHibernate
 
香港六合彩
香港六合彩香港六合彩
香港六合彩
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
Zend framework
Zend frameworkZend framework
Zend framework
 

Plus de Shahzad

Srs sso-version-1.2-stable version-0
Srs sso-version-1.2-stable version-0Srs sso-version-1.2-stable version-0
Srs sso-version-1.2-stable version-0Shahzad
 
Srs sso-version-1.2-stable version
Srs sso-version-1.2-stable versionSrs sso-version-1.2-stable version
Srs sso-version-1.2-stable versionShahzad
 
Exploration note - none windows based authentication for WCF
Exploration note - none windows based authentication for WCFExploration note - none windows based authentication for WCF
Exploration note - none windows based authentication for WCFShahzad
 
To study pcms pegasus erp cargo management system-release-7 from architectu...
To study pcms   pegasus erp cargo management system-release-7 from architectu...To study pcms   pegasus erp cargo management system-release-7 from architectu...
To study pcms pegasus erp cargo management system-release-7 from architectu...Shahzad
 
To study pcms pegasus erp cargo management system-release-6 from architectu...
To study pcms   pegasus erp cargo management system-release-6 from architectu...To study pcms   pegasus erp cargo management system-release-6 from architectu...
To study pcms pegasus erp cargo management system-release-6 from architectu...Shahzad
 
Pakistan management
Pakistan managementPakistan management
Pakistan managementShahzad
 
Corporate lessons
Corporate lessonsCorporate lessons
Corporate lessonsShahzad
 
What is future of web with reference to html5 will it devalue current present...
What is future of web with reference to html5 will it devalue current present...What is future of web with reference to html5 will it devalue current present...
What is future of web with reference to html5 will it devalue current present...Shahzad
 
Software architecture to analyze licensing needs for pcms- pegasus cargo ma...
Software architecture   to analyze licensing needs for pcms- pegasus cargo ma...Software architecture   to analyze licensing needs for pcms- pegasus cargo ma...
Software architecture to analyze licensing needs for pcms- pegasus cargo ma...Shahzad
 
A cross referenced whitepaper on cloud computing
A cross referenced whitepaper on cloud computingA cross referenced whitepaper on cloud computing
A cross referenced whitepaper on cloud computingShahzad
 
Software architecture case study - why and why not sql server replication
Software architecture   case study - why and why not sql server replicationSoftware architecture   case study - why and why not sql server replication
Software architecture case study - why and why not sql server replicationShahzad
 
Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1...
Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1...Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1...
Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1...Shahzad
 
From Windows Presentation Foundation To Silverlight
From Windows Presentation Foundation To SilverlightFrom Windows Presentation Foundation To Silverlight
From Windows Presentation Foundation To SilverlightShahzad
 
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...
To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...Shahzad
 
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...
To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...Shahzad
 
To Analyze Cargo Loading Optimization Algorithm
To Analyze Cargo Loading Optimization AlgorithmTo Analyze Cargo Loading Optimization Algorithm
To Analyze Cargo Loading Optimization AlgorithmShahzad
 
Whitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql ServerWhitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql ServerShahzad
 
Case Study For Replication For PCMS
Case Study For Replication For PCMSCase Study For Replication For PCMS
Case Study For Replication For PCMSShahzad
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#Shahzad
 

Plus de Shahzad (20)

Srs sso-version-1.2-stable version-0
Srs sso-version-1.2-stable version-0Srs sso-version-1.2-stable version-0
Srs sso-version-1.2-stable version-0
 
Srs sso-version-1.2-stable version
Srs sso-version-1.2-stable versionSrs sso-version-1.2-stable version
Srs sso-version-1.2-stable version
 
Exploration note - none windows based authentication for WCF
Exploration note - none windows based authentication for WCFExploration note - none windows based authentication for WCF
Exploration note - none windows based authentication for WCF
 
To study pcms pegasus erp cargo management system-release-7 from architectu...
To study pcms   pegasus erp cargo management system-release-7 from architectu...To study pcms   pegasus erp cargo management system-release-7 from architectu...
To study pcms pegasus erp cargo management system-release-7 from architectu...
 
To study pcms pegasus erp cargo management system-release-6 from architectu...
To study pcms   pegasus erp cargo management system-release-6 from architectu...To study pcms   pegasus erp cargo management system-release-6 from architectu...
To study pcms pegasus erp cargo management system-release-6 from architectu...
 
Pakistan management
Pakistan managementPakistan management
Pakistan management
 
Corporate lessons
Corporate lessonsCorporate lessons
Corporate lessons
 
What is future of web with reference to html5 will it devalue current present...
What is future of web with reference to html5 will it devalue current present...What is future of web with reference to html5 will it devalue current present...
What is future of web with reference to html5 will it devalue current present...
 
Software architecture to analyze licensing needs for pcms- pegasus cargo ma...
Software architecture   to analyze licensing needs for pcms- pegasus cargo ma...Software architecture   to analyze licensing needs for pcms- pegasus cargo ma...
Software architecture to analyze licensing needs for pcms- pegasus cargo ma...
 
A cross referenced whitepaper on cloud computing
A cross referenced whitepaper on cloud computingA cross referenced whitepaper on cloud computing
A cross referenced whitepaper on cloud computing
 
Software architecture case study - why and why not sql server replication
Software architecture   case study - why and why not sql server replicationSoftware architecture   case study - why and why not sql server replication
Software architecture case study - why and why not sql server replication
 
Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1...
Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1...Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1...
Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1...
 
From Windows Presentation Foundation To Silverlight
From Windows Presentation Foundation To SilverlightFrom Windows Presentation Foundation To Silverlight
From Windows Presentation Foundation To Silverlight
 
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...
To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...
 
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...
To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...To Study  E T L ( Extract, Transform, Load) Tools Specially  S Q L  Server  I...
To Study E T L ( Extract, Transform, Load) Tools Specially S Q L Server I...
 
To Analyze Cargo Loading Optimization Algorithm
To Analyze Cargo Loading Optimization AlgorithmTo Analyze Cargo Loading Optimization Algorithm
To Analyze Cargo Loading Optimization Algorithm
 
Asp
AspAsp
Asp
 
Whitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql ServerWhitepaper To Study Filestream Option In Sql Server
Whitepaper To Study Filestream Option In Sql Server
 
Case Study For Replication For PCMS
Case Study For Replication For PCMSCase Study For Replication For PCMS
Case Study For Replication For PCMS
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#
 

Dernier

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Dernier (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

OR Mapping- nhibernate Presentation

  • 1. Presentation Agenda on nhibernate: By: Shahzad Sarwar To: Development Team
  • 2. Part 1: 1st Aug 2009 3:30 PM Part 2: Later • Version 2.1 new features • Performance tuning • Proxing • Cache • Design pattern for NHibernate • Case Specific provider
  • 3. What is OR Mapping. OR Mapping Frameworks Overview of LINQ Types of LINQ LINQ 2 SQL LINQ 2 Entities Samples for LINQ What is nHibernate? A .Net port of Hibernate of Java Covers: Mapping and Data query format Hides SQL and ADO.NET. XML Configuration File <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <!-- an ISessionFactory instance --> <session-factory> <!-- properties --> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</ property> <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> <property name="connection.connection_string">Server=localhost;initial catalog=nhibernate;User Id=;Password=</property> <property name="show_sql">false</property> <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property> <property name="use_outer_join">true</property> <!-- mapping files --> <mapping resource="NHibernate.Auction.Item.hbm.xml" assembly="NHibernate.Auction" /> <mapping resource="NHibernate.Auction.Bid.hbm.xml" assembly="NHibernate.Auction" /> </session-factory>
  • 4. </hibernate-configuration> Persistent vs transient Objects Level of abstraction Page/Application level scope. Eg: Datetime dt; Session/application level vatables DB Level Even shutdown of machine Searlization as file /DB POCO vs POJO Samples Nhibernate Basic Mapping file - hbm.xml Entity class public class Category { #region Fields private int _CategoryID; private string _Description; #endregion #region Constructors /// <summary> /// Initializes a new instance of the Account class /// </summary> public Category() { } public Category(int CategoryID, string Description) { this._CategoryID = CategoryID; this._Description = Description; } #endregion #region Properties /// <summary> /// Gets or sets theCategoryID for the current Category); /// </summary> public virtual int CategoryID { get { return _CategoryID; } set { _CategoryID = value; } }
  • 5. /// <summary> /// Gets or sets theDescription for the current Category); /// </summary> public virtual string Description { get { return _Description; } set { _Description = value; } } #endregion } <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHDEMO" namespace="Lib"> <class name="Category" table="Category" dynamic-update="true" optimistic-lock="dirty" > <id name="CategoryID" column="CategoryID"> <generator class="native"/> </id> <property name="Description" column="Description" type="String" length="250" /> </class> </hibernate-mapping> Show samples Code generation 1. Avva Open source Solution Get latest copy from $NHTool.root See attached Manual.
  • 6. Introduction Here is a tool for the use of your own applications that NHibernate. You can easily install and use this helper kit. To download, please click the link at the top of the page. If you are using NHibernate, you need to write a lot of persistent classes and XML mapping for each persistent class. Also, you need to write the NHibernate config file. At this point, using this tool, you can automatically create all these files in a few seconds. Using There are four tab screens on the tool.
  • 7. 1. Connection: This screen allows you to connect your database with connection parameters. It looks like the Visual Studio connection wizard. You need to set some parameters to connect to your database. 2. Tables & Columns: This screen allows you to browse a selected database's tables and select them to create files. Also, if you want, you can see a table's column information by selecting from a table from a list and clicking "Preview Columns".
  • 8.
  • 9. 3. Settings: This screen allows you to select some features, for example, copy the NHibernate DLL and use dynamic updates. Also, you have to select your project folder to configure the folders, namespaces, and assembly names.
  • 10. 4. Generate: At the end of this, we can start the generate process. Just click Run and wait a few seconds. You can view all the process details in this section.
  • 11. After you've successfully completed the generating process, you can see the generated files in the project folder. If you selected "Copy NHibernate DLL to project" and other DLLs, the generator will copy it and create an NHibernate config file in your project's "bin" folder.
  • 12. Also, the generator creates a folder named App_Code in your project folder to put persistent classes and mapping files in. It directly creates persistent classes to App_Code, and mapping files creates them in the NHMappings folder, as follows: Let's check it out how it's looking. Persistent class
  • 14. 2. NConstruct Lite Neat Code, but not customizable as it is commercial product
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. CRUDE Operation Sample See Sample demo for CRUDE operations. dynamic-update dynamic-insert select-before-update one-to-one one-to-many many-to-one bag fetch = join-select for category HQL cascade Nhibernate Analyiser: 1. SQL Server Analyiser
  • 21.
  • 22.
  • 24. 3.