SlideShare a Scribd company logo
Kiev ALT.NET



NHibernate from inside
      by Andriy Buday
NHibernate guts. Why?
Because… it is fun… interesting…




                 http://andriybuday.com | http://kievalt.net
NHibernate guts. Why?
And not so scary as you could have thought




                 http://andriybuday.com | http://kievalt.net
Outline
   Q1: If build similar ORM ourselves?
   Q2: How does it look like at glance?
       History
       Community
       Code base quality
   Q3: Dive deeper?
       Main interaction classes
       DEMO 1: Debugging fetch logic
       DEMO 2: Debugging save logic


    Let see… if guts could be interesting o_O
                        http://andriybuday.com | http://kievalt.net
Q1: If build similar ORM ourselves?
Lets draw…




                 http://andriybuday.com | http://kievalt.net
Q1: If build similar ORM ourselves?
This might be the solution we came up with…




Even uglier than real cave drawing 
                http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
History




                 http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
Community




                 http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
NDepend analysis




                 http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
NDepend analysis: Application Metrics
L. of code : 62,914                Fields : 7,205
L. of comment: 37,113              C# source files : 1,437
Assemblies : 3                     IL instruction : 437,982
Namespaces : 90                    Classes : 1,866
Types : 2,211                      UT coverage: 75.93%
Methods : 18,335




                http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
Architecture: entity states




                 http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
Architecture: more




                 http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
Personal opinion: really well-commented
/// <summary>
/// Get the alias of the entity encapsulated by this criteria instance.
/// </summary>
/// <value>The alias for the encapsulated entity.</value>
string Alias { get; }

/// <summary>
/// Was the read-only mode explicitly initialized?
/// </summary>
/// <returns><c>true</c> if the read-only mode was explicitly initialized, otherwise <c>false</c>.</returns>
/// <seealso cref="ICriteria.SetReadOnly(bool)" />
/// <seealso cref="ICriteria.IsReadOnly" />///
bool IsReadOnlyInitialized { get; }

/// <summary>
/// Will entities (and proxies) loaded by this Criteria be put in read-only mode?
/// </summary>
/// <remarks>
/// <para>
/// If the read-only setting was not initialized, then the value of the session's
/// <see cref="ISession.DefaultReadOnly" /> property is returned instead.
/// </para>
/// <para>
/// The read-only setting has no impact on entities or proxies returned by the
/// Criteria that existed in the session before the Criteria was executed.
/// </para>
/// </remarks>
/// <returns>
/// <c>true</c> if entities and proxies loaded by the criteria will be put in read-only mode,
/// otherwise <c>false</c>.
/// </returns>
/// <seealso cref="ICriteria.SetReadOnly(bool)" />
/// <seealso cref="ICriteria.IsReadOnlyInitialized" />
bool IsReadOnly { get; }

/// <summary>
/// Used to specify that the query results will be a projection (scalar in
/// nature). Implicitly specifies the projection result transformer.
/// </summary>
/// <param name="projection">The projection representing the overall "shape" of the
/// query results.</param>
/// <returns>This instance (for method chaining)</returns>
/// <remarks>
/// <para>
/// The individual components contained within the given <see cref="IProjection"/>
/// determines the overall "shape" of the query result.
/// </para>
/// </remarks>
ICriteria SetProjection(params IProjection[] projection);




Don’t read code – see how green it is 
                                                                           http://andriybuday.com | http://kievalt.net
Q2: How does it look like at glance?
Personal opinion: a lot of noise in code
if (cmd.Connection != null)
{
  // make sure the commands connection is the same as the Sessions connection
  // these can be different when the session is disconnected and then reconnected
  if (cmd.Connection != sessionConnection)
  {
       cmd.Connection = sessionConnection;
  }
}
else
{
    cmd.Connection = sessionConnection;
}




Now read code!
Don’t you think it can be replaced?
cmd.Connection = sessionConnection;
                          http://andriybuday.com | http://kievalt.net
Q3: Dive deeper?
Lets have some fun with code & debugging…




                http://andriybuday.com | http://kievalt.net
Q3: Dive deeper?
Lets have some fun with code & debugging…




  Overview
  DEMO 1: Debugging fetch
  DEMO 2: Debugging save
                http://andriybuday.com | http://kievalt.net
Questions?




       Ask me something! But easy!
             http://andriybuday.com | http://kievalt.net
Read blog! Follow me! Visit KIEV ALT.NET!

                      http://andriybuday.com/


                       @andriybuday

                      andriybuday@gmail.com


                       http://kievalt.net/


               http://andriybuday.com | http://kievalt.net
Links
   My blog:
       http://andriybuday.com
   Kiev ALT.NET:
       http://kievalt.net/
   NHibernate:
       Home Page: http://nhforge.org/
       Source Code: https://github.com/nhibernate/nhibernate-core
       Screencasts: http://www.summerofnhibernate.com/
       Reference: http://www.nhforge.org/doc/nh/en/index.html
       NDepend analysis:
        http://www.ndepend.com/SampleReports/OnNHibernate/NDependReport.html
       So what’s NH development look like: http://elegantcode.com/2008/12/07/so-
        whats-nhibernate-development-like/
       Mapping by code:
       http://fabiomaulo.blogspot.com/2011/04/nhibernate-32-mapping-by-code.html




                              http://andriybuday.com | http://kievalt.net

More Related Content

Viewers also liked

OpenERP 6.0
OpenERP 6.0OpenERP 6.0
OpenERP 6.0
Nicosinterests
 
Hibernate
HibernateHibernate
Hibernate
Chris Roeder
 
Introduction to NHibernate
Introduction to NHibernateIntroduction to NHibernate
Introduction to NHibernate
Dublin Alt,Net
 
NHibernate
NHibernateNHibernate
NHibernate
Andriy Buday
 
NHibernate for .NET
NHibernate for .NETNHibernate for .NET
NHibernate for .NET
Guo Albert
 
NHibernate
NHibernateNHibernate
NHibernate
gabrielcerutti
 
NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)
Samnang Chhun
 
Руйнуємо .NET Міфи
Руйнуємо .NET МіфиРуйнуємо .NET Міфи
Руйнуємо .NET Міфи
Serhiy Kalinets
 
Micro orm для жизни. Кожевников Дмитрий D2D Just.NET
Micro orm для жизни. Кожевников Дмитрий D2D Just.NETMicro orm для жизни. Кожевников Дмитрий D2D Just.NET
Micro orm для жизни. Кожевников Дмитрий D2D Just.NET
Dev2Dev
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
Alan Christensen
 
Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”
Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”
Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”
Lviv Startup Club
 
State of entity framework
State of entity frameworkState of entity framework
State of entity framework
David Paquette
 
The Innovation Game: Why & How Businesses are Investing in Innovation Centers
The Innovation Game: Why & How Businesses are Investing in Innovation Centers The Innovation Game: Why & How Businesses are Investing in Innovation Centers
The Innovation Game: Why & How Businesses are Investing in Innovation Centers
Capgemini
 

Viewers also liked (15)

OpenERP 6.0
OpenERP 6.0OpenERP 6.0
OpenERP 6.0
 
Ddd
DddDdd
Ddd
 
Hibernate
HibernateHibernate
Hibernate
 
Introduction to NHibernate
Introduction to NHibernateIntroduction to NHibernate
Introduction to NHibernate
 
NHibernate
NHibernateNHibernate
NHibernate
 
NHibernate for .NET
NHibernate for .NETNHibernate for .NET
NHibernate for .NET
 
NHibernate
NHibernateNHibernate
NHibernate
 
ASP.Net MVC
ASP.Net MVCASP.Net MVC
ASP.Net MVC
 
NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)
 
Руйнуємо .NET Міфи
Руйнуємо .NET МіфиРуйнуємо .NET Міфи
Руйнуємо .NET Міфи
 
Micro orm для жизни. Кожевников Дмитрий D2D Just.NET
Micro orm для жизни. Кожевников Дмитрий D2D Just.NETMicro orm для жизни. Кожевников Дмитрий D2D Just.NET
Micro orm для жизни. Кожевников Дмитрий D2D Just.NET
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”
Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”
Lviv MDDay 2014. Дмитро Андреєв “знайомство з .Net micro framework”
 
State of entity framework
State of entity frameworkState of entity framework
State of entity framework
 
The Innovation Game: Why & How Businesses are Investing in Innovation Centers
The Innovation Game: Why & How Businesses are Investing in Innovation Centers The Innovation Game: Why & How Businesses are Investing in Innovation Centers
The Innovation Game: Why & How Businesses are Investing in Innovation Centers
 

Similar to NHibernate from inside

Lviv .Net User Group. NHibernate
Lviv .Net User Group. NHibernateLviv .Net User Group. NHibernate
Lviv .Net User Group. NHibernate
Dima Maleev
 
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
Marco Cedaro
 
Angular Best Practices v2
Angular Best Practices v2Angular Best Practices v2
Angular Best Practices v2
Henry Tao
 
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
Marco Cedaro
 
2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static
Lincoln III
 
DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)
Oleg Zinchenko
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Matt Raible
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
Hiro Asari
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
Mark Fayngersh
 
Web services and JavaScript
Web services and JavaScriptWeb services and JavaScript
Web services and JavaScript
Christian Heilmann
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
Marko Mitranić
 
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by DefaultJS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JSFestUA
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
Kevlin Henney
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
Matt Raible
 
Stefan Judis "Did we(b development) lose the right direction?"
Stefan Judis "Did we(b development) lose the right direction?"Stefan Judis "Did we(b development) lose the right direction?"
Stefan Judis "Did we(b development) lose the right direction?"
Fwdays
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Andrzej Jóźwiak
 
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
10 things about BDD, Cucumber and SpecFlow - Long Version 201610 things about BDD, Cucumber and SpecFlow - Long Version 2016
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
Seb Rose
 
Containerize vs Virtualize? NGDC 2009
Containerize vs Virtualize? NGDC 2009Containerize vs Virtualize? NGDC 2009
Containerize vs Virtualize? NGDC 2009
Andy d
 
The Open Web
The Open WebThe Open Web
The Open Web
Lachlan Hardy
 
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
Steve Feldman
 

Similar to NHibernate from inside (20)

Lviv .Net User Group. NHibernate
Lviv .Net User Group. NHibernateLviv .Net User Group. NHibernate
Lviv .Net User Group. NHibernate
 
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
 
Angular Best Practices v2
Angular Best Practices v2Angular Best Practices v2
Angular Best Practices v2
 
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
 
2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static
 
DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
Web services and JavaScript
Web services and JavaScriptWeb services and JavaScript
Web services and JavaScript
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
 
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by DefaultJS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
JS Fest 2019. Minko Gechev. Building Fast Angular Applications by Default
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Stefan Judis "Did we(b development) lose the right direction?"
Stefan Judis "Did we(b development) lose the right direction?"Stefan Judis "Did we(b development) lose the right direction?"
Stefan Judis "Did we(b development) lose the right direction?"
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
 
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
10 things about BDD, Cucumber and SpecFlow - Long Version 201610 things about BDD, Cucumber and SpecFlow - Long Version 2016
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
 
Containerize vs Virtualize? NGDC 2009
Containerize vs Virtualize? NGDC 2009Containerize vs Virtualize? NGDC 2009
Containerize vs Virtualize? NGDC 2009
 
The Open Web
The Open WebThe Open Web
The Open Web
 
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...Microsoft Power Point   Best Practices For Scaling Heavily Adopted And Concur...
Microsoft Power Point Best Practices For Scaling Heavily Adopted And Concur...
 

More from Andriy Buday

Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
Andriy Buday
 
Windows Communicaiton Foundation
Windows Communicaiton FoundationWindows Communicaiton Foundation
Windows Communicaiton Foundation
Andriy Buday
 
Auto mapper
Auto mapperAuto mapper
Auto mapper
Andriy Buday
 
Mock Objects Presentation
Mock Objects PresentationMock Objects Presentation
Mock Objects Presentation
Andriy Buday
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency Injection
Andriy Buday
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
Andriy Buday
 

More from Andriy Buday (6)

Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Windows Communicaiton Foundation
Windows Communicaiton FoundationWindows Communicaiton Foundation
Windows Communicaiton Foundation
 
Auto mapper
Auto mapperAuto mapper
Auto mapper
 
Mock Objects Presentation
Mock Objects PresentationMock Objects Presentation
Mock Objects Presentation
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency Injection
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 

Recently uploaded

GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 

Recently uploaded (20)

GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 

NHibernate from inside

  • 1. Kiev ALT.NET NHibernate from inside by Andriy Buday
  • 2. NHibernate guts. Why? Because… it is fun… interesting… http://andriybuday.com | http://kievalt.net
  • 3. NHibernate guts. Why? And not so scary as you could have thought http://andriybuday.com | http://kievalt.net
  • 4. Outline  Q1: If build similar ORM ourselves?  Q2: How does it look like at glance?  History  Community  Code base quality  Q3: Dive deeper?  Main interaction classes  DEMO 1: Debugging fetch logic  DEMO 2: Debugging save logic Let see… if guts could be interesting o_O http://andriybuday.com | http://kievalt.net
  • 5. Q1: If build similar ORM ourselves? Lets draw… http://andriybuday.com | http://kievalt.net
  • 6. Q1: If build similar ORM ourselves? This might be the solution we came up with… Even uglier than real cave drawing  http://andriybuday.com | http://kievalt.net
  • 7. Q2: How does it look like at glance? History http://andriybuday.com | http://kievalt.net
  • 8. Q2: How does it look like at glance? Community http://andriybuday.com | http://kievalt.net
  • 9. Q2: How does it look like at glance? NDepend analysis http://andriybuday.com | http://kievalt.net
  • 10. Q2: How does it look like at glance? NDepend analysis: Application Metrics L. of code : 62,914 Fields : 7,205 L. of comment: 37,113 C# source files : 1,437 Assemblies : 3 IL instruction : 437,982 Namespaces : 90 Classes : 1,866 Types : 2,211 UT coverage: 75.93% Methods : 18,335 http://andriybuday.com | http://kievalt.net
  • 11. Q2: How does it look like at glance? Architecture: entity states http://andriybuday.com | http://kievalt.net
  • 12. Q2: How does it look like at glance? Architecture: more http://andriybuday.com | http://kievalt.net
  • 13. Q2: How does it look like at glance? Personal opinion: really well-commented /// <summary> /// Get the alias of the entity encapsulated by this criteria instance. /// </summary> /// <value>The alias for the encapsulated entity.</value> string Alias { get; } /// <summary> /// Was the read-only mode explicitly initialized? /// </summary> /// <returns><c>true</c> if the read-only mode was explicitly initialized, otherwise <c>false</c>.</returns> /// <seealso cref="ICriteria.SetReadOnly(bool)" /> /// <seealso cref="ICriteria.IsReadOnly" />/// bool IsReadOnlyInitialized { get; } /// <summary> /// Will entities (and proxies) loaded by this Criteria be put in read-only mode? /// </summary> /// <remarks> /// <para> /// If the read-only setting was not initialized, then the value of the session's /// <see cref="ISession.DefaultReadOnly" /> property is returned instead. /// </para> /// <para> /// The read-only setting has no impact on entities or proxies returned by the /// Criteria that existed in the session before the Criteria was executed. /// </para> /// </remarks> /// <returns> /// <c>true</c> if entities and proxies loaded by the criteria will be put in read-only mode, /// otherwise <c>false</c>. /// </returns> /// <seealso cref="ICriteria.SetReadOnly(bool)" /> /// <seealso cref="ICriteria.IsReadOnlyInitialized" /> bool IsReadOnly { get; } /// <summary> /// Used to specify that the query results will be a projection (scalar in /// nature). Implicitly specifies the projection result transformer. /// </summary> /// <param name="projection">The projection representing the overall "shape" of the /// query results.</param> /// <returns>This instance (for method chaining)</returns> /// <remarks> /// <para> /// The individual components contained within the given <see cref="IProjection"/> /// determines the overall "shape" of the query result. /// </para> /// </remarks> ICriteria SetProjection(params IProjection[] projection); Don’t read code – see how green it is  http://andriybuday.com | http://kievalt.net
  • 14. Q2: How does it look like at glance? Personal opinion: a lot of noise in code if (cmd.Connection != null) { // make sure the commands connection is the same as the Sessions connection // these can be different when the session is disconnected and then reconnected if (cmd.Connection != sessionConnection) { cmd.Connection = sessionConnection; } } else { cmd.Connection = sessionConnection; } Now read code! Don’t you think it can be replaced? cmd.Connection = sessionConnection; http://andriybuday.com | http://kievalt.net
  • 15. Q3: Dive deeper? Lets have some fun with code & debugging… http://andriybuday.com | http://kievalt.net
  • 16. Q3: Dive deeper? Lets have some fun with code & debugging…  Overview  DEMO 1: Debugging fetch  DEMO 2: Debugging save http://andriybuday.com | http://kievalt.net
  • 17. Questions? Ask me something! But easy! http://andriybuday.com | http://kievalt.net
  • 18. Read blog! Follow me! Visit KIEV ALT.NET! http://andriybuday.com/ @andriybuday andriybuday@gmail.com http://kievalt.net/ http://andriybuday.com | http://kievalt.net
  • 19. Links  My blog:  http://andriybuday.com  Kiev ALT.NET:  http://kievalt.net/  NHibernate:  Home Page: http://nhforge.org/  Source Code: https://github.com/nhibernate/nhibernate-core  Screencasts: http://www.summerofnhibernate.com/  Reference: http://www.nhforge.org/doc/nh/en/index.html  NDepend analysis: http://www.ndepend.com/SampleReports/OnNHibernate/NDependReport.html  So what’s NH development look like: http://elegantcode.com/2008/12/07/so- whats-nhibernate-development-like/  Mapping by code:  http://fabiomaulo.blogspot.com/2011/04/nhibernate-32-mapping-by-code.html http://andriybuday.com | http://kievalt.net

Editor's Notes

  1. Hello, Kiev ALT.NET!
  2. Invented in early 1990’sOne of the first came from ClevelandRaleigh Systems’ ObjectPMShield the OO application from the database paradigmMappings to tables and columns are localized in configuration filesInitially developed for Javacreated in late 2001 by Gavin Kingabsorbed by the JBoss Group / Red HatPorted to .NET 1.1 and 2.0Resulting product called “NHibernate”All popular databases supportedXML-based configuration files----------------NHibernate was started by Tom Barrett, and later picked up by Mike Doerfler and Peter Smulovics. Now Fabio Maulo is the project leader. At the end of 2005, JBoss, Inc. (now part of Red Hat) hired Sergey Koshcheyev, the then lead developer of NHibernate, to work full-time on its future versions.[2] At the end of 2006 JBoss stopped the support to this project; it is now entirely developed and led by the community.Version 1.0 mirrored the feature set of Hibernate 2.1, as well as a number of features from Hibernate 3.NHibernate 1.2.1, released in November 2007, introduced many more features from Hibernate 3 and support for .NET 2.0, stored procedures, generics, and nullable types.NHibernate 2.0 was released August 23, 2008. It is comparable to Hibernate 3.2 in terms of features. With the version 2.0 release, NHibernate dropped support for .NET 1.1.[3]NHibernate 2.1 was released July 17, 2009.NHibernate 3.0 was released on December 04, 2010 and is the first version to use .NET 3.5. Introduces integrated LINQ support and also strongly typed criteria-like API called QueryOver, new AST-based parser for NHibernate&apos;s HQL (Hibernate Query Language) engine, support for lazy loading columns.NHibernate 3.2 has been released recently.[edit] What is new in NHibernate 3.2Some of the new Features are [4]Mapping by code: fluent configuration, no more .hbm.xml files required;Subselect: ability to map SQL views as entities;HQL paging: TAKE and SKIP on HQL;Integrated bytecode provider: one less DLL to deploy.----------------
  3. http://elegantcode.com/2008/12/07/so-whats-nhibernate-development-like/jira - issue trackergithub – source code staroge
  4. http://ayende.com/blog/2703/working-with-antlr-hql-grammarApplication MetricsNote: Further Application Statistics are available. # Lines of code : 62,914# Assemblies : 3# Namespaces : 90# Types : 2,211# Methods : 18,335# Fields : 7,205# C# source files : 1,437# IL instruction : 437,982# Lines of comment : 37,113# Classes : 1,866# Abstract classes : 117# Interfaces : 287# Value types : 7# Exception types : 51# Attribute types : 1# Delegate types : 21# Enumeration types : 51# Generic methods : 405# Generic types : 83Third Party Usage # Assemblies used : 14 # Namespaces used : 63 # Types used : 474 # Methods used : 1,201 # Fields used : 97Percentage …… code coverage : 75.93%   … of comment : 37%  … of public types : 85.39%  … of public methods : 78.41%  … of classes with public field(s) : 7.6%
  5. Application Metrics                    Note: Further Application Statistics are available. # Lines of code : 62,914# Assemblies : 3# Namespaces : 90# Types : 2,211# Methods : 18,335# Fields : 7,205# C# source files : 1,437# IL instruction : 437,982# Lines of comment : 37,113# Classes : 1,866# Abstract classes : 117# Interfaces : 287# Value types : 7# Exception types : 51# Attribute types : 1# Delegate types : 21# Enumeration types : 51# Generic methods : 405# Generic types : 83Third Party Usage # Assemblies used : 14 # Namespaces used : 63 # Types used : 474 # Methods used : 1,201 # Fields used : 97Percentage …… code coverage : 75.93%   … of comment : 37%  … of public types : 85.39%  … of public methods : 78.41%  … of classes with public field(s) : 7.6%
  6. http://elegantcode.com/2008/12/07/so-whats-nhibernate-development-like/