SlideShare a Scribd company logo
1 of 37
Introduction to FluentData

Lars-Erik Kindblad
Senior Consultant
Blog: kindblad.com
Agenda

   What is FluentData?
   Why was FluentData created?
   Architecture
   Sample code
   Road map




                                      | Sector, Alliance, Offering
What is FluentData?

   Micro ORM for .NET
   Makes it simple to query a relational database
   Open Source
   MIT license
   http://fluentdata.codeplex.com
   NuGet: FluentData




                                                     | Sector, Alliance, Offering
Why was FluentData created?
 ORMs such as Entity Framework and NHibernate have too many
  disadvantages
  • Framework is too complex
  • Forces you to design the .NET Model in a special way by using attributes and
    ORM Framework specific types
  • Hard to define the mapping between the database model and business model
  • A lot of mapping code/XML – not any less code than SQL and manual mapping
  • Uses an abstracted query language instead of SQL
     o Hard to do complex queries, Generates poor SQL, Slow
  • Takes a long time to learn and master
  • Drag and drop designers are buggy and limiting
  • = Leads to unpredictable development time and performance
 ... had to be a better way to do it

                                                                    | Sector, Alliance, Offering
Alternatives to ORMs?

 ADO.NET
 •   Powerful
 •   Flexible
 •   Great performance
 •   ... but too much manual code




                                                  | Sector, Alliance, Offering
A Better Alternative?



    ORM             Micro ORM            ADO.NET




Secure                                 Fast
Auto mapping         Simple
                                       Flexible
                     Fast
                                       Predictable
                     Flexible
                                       Manual mapping
                     Predictable
                     Secure
                     Auto mapping
                     Manual mapping

                                          | Sector, Alliance, Offering
Micro ORM

 Uses SQL – the native and optimized query language for databases,
  rock solid – in use since the 70s
 Thin wrapper layer on top of ADO.NET:
  • Reduce repetitive code
  • Support auto mapping
 Map per query instead of per Entity

 = Result
  • Fast
  • Simple
  • Efficient


                                                        | Sector, Alliance, Offering
Goals of FluentData

 Easy to learn
 Simple and efficient to use
 Fast
 Secure
 Single DLL
 Only the Data Access Layer should be affected by FluentData
 Select queries should be SQL, insert, update and delete queries can
  be SQL or generated
 Support the major databases



                                                          | Sector, Alliance, Offering
Features

 Fluent API
 Supports SQL Server, SQL Server Compact, SQL Azure, Access,
  MySQL, Oracle
 Use SQL to select data and builders to insert, update, delete data
 Supports
  •   Auto mapping and custom mapping
  •   Stored Procedures
  •   Transactions
  •   Multiple result sets
  •   Custom collections eg. ProductCollection instead of List<Product>
  •   Provider model
  •   ++

                                                                          | Sector, Alliance, Offering
Architecture




               | Sector, Alliance, Offering
DbContext

 Starting point for working with FluentData
 Use it to define settings such as
  • ConnectionString or ConnectionStringName
  • UseTransaction
 Hook up your own method to any of the supported events
  •   OnConnectionOpened
  •   OnConnectionOpening
  •   OnConnectionClosed
  •   OnExecuting
  •   OnExecuted
  •   OnError


                                                           | Sector, Alliance, Offering
DbCommand

 Responsible for performing the actually query against the database




                                                          | Sector, Alliance, Offering
Mapping

 FluentData can automap query results to your own entity type or to a
  dynamic type (new in .NET 4.0)
 or you can map the query results manually




                                                           | Sector, Alliance, Offering
Builders

 Fluent API to generate SQL for insert, update and delete queries




                                                           | Sector, Alliance, Offering
Sample Code
Getting started

 Download FluentData.dll from either
  • FluentData.CodePlex.com
  • NuGet
 Add a reference to FluentData.dll in your Data Access Project




                                                           | Sector, Alliance, Offering
Model
Database




 .NET




           | Sector, Alliance, Offering
Create and Initialize the DbContext




                                      | Sector, Alliance, Offering
INSERT DATA

              | Sector, Alliance, Offering
Insert a Category



       SQL




      Builder




                    | Sector, Alliance, Offering
UPDATE DATA

              | Sector, Alliance, Offering
Update a Product




                   | Sector, Alliance, Offering
DELETE DATA

              | Sector, Alliance, Offering
Delete a Product




                   | Sector, Alliance, Offering
SELECT DATA

              | Sector, Alliance, Offering
Select a Category




                    | Sector, Alliance, Offering
Select all Categories

 Map to List<Category>




 Map to CategoryCollection




                             | Sector, Alliance, Offering
Select all Products with the related Category

                Auto Mapping




                                                | Sector, Alliance, Offering
Select all Products with the related Category

             Manual Mapping




                                                | Sector, Alliance, Offering
Count the number of Products




                               | Sector, Alliance, Offering
Select All Categories + All Products




                                       | Sector, Alliance, Offering
Select Products 1,2,3,4




                          | Sector, Alliance, Offering
TRANSACTIONS

               | Sector, Alliance, Offering
Insert multiple products within a Transaction




                                                | Sector, Alliance, Offering
Road map

 Add support for more databases
  • SQLite, PostgreSQL +
 Add a Select Builder with Paging support and strongly typed auto
  mapping
 Simplify code
 Single Source File
 Performance improvements
 .NET intellisense for the database model




                                                          | Sector, Alliance, Offering
QUESTIONS?

             | Sector, Alliance, Offering
www.capgemini.com



The information contained in this presentation is proprietary. ©2010 Capgemini. All rights reserved

More Related Content

What's hot

Adaptive Network Middleware CSC (Communication Service Concierge) - R Kawamura
Adaptive Network Middleware CSC (Communication Service Concierge)  - R KawamuraAdaptive Network Middleware CSC (Communication Service Concierge)  - R Kawamura
Adaptive Network Middleware CSC (Communication Service Concierge) - R Kawamura
mfrancis
 
Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...
Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...
Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...
mfrancis
 

What's hot (8)

Modernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsModernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standards
 
Modernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsModernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standards
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
 
AXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsAXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systems
 
Adaptive Network Middleware CSC (Communication Service Concierge) - R Kawamura
Adaptive Network Middleware CSC (Communication Service Concierge)  - R KawamuraAdaptive Network Middleware CSC (Communication Service Concierge)  - R Kawamura
Adaptive Network Middleware CSC (Communication Service Concierge) - R Kawamura
 
AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...
 
Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...
Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...
Evolving Communication Mechanisms of the OSGi Framework - Xuejun Chen, BMW Re...
 
OSGi Community Event 2010 - Experiences with OSGi in Industrial Applications
OSGi Community Event 2010 - Experiences with OSGi in Industrial ApplicationsOSGi Community Event 2010 - Experiences with OSGi in Industrial Applications
OSGi Community Event 2010 - Experiences with OSGi in Industrial Applications
 

Viewers also liked

Anforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML GrundlagenAnforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML Grundlagen
Christian Baranowski
 
Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8
chmoser79
 

Viewers also liked (20)

Angular JS deep dive
Angular JS deep diveAngular JS deep dive
Angular JS deep dive
 
Micro ORM vs Entity Framework
Micro ORM vs Entity FrameworkMicro ORM vs Entity Framework
Micro ORM vs Entity Framework
 
Responsive Design - Quick & Dirty
Responsive Design - Quick & DirtyResponsive Design - Quick & Dirty
Responsive Design - Quick & Dirty
 
Webinar: Responsive Design
Webinar: Responsive DesignWebinar: Responsive Design
Webinar: Responsive Design
 
Unit Tests are Overrated (NDCOslo 2013)
Unit Tests are Overrated (NDCOslo 2013)Unit Tests are Overrated (NDCOslo 2013)
Unit Tests are Overrated (NDCOslo 2013)
 
Ready or not: No UI vom Verschwinden des Graphical User Interfaces
Ready or not: No UI vom Verschwinden des Graphical User InterfacesReady or not: No UI vom Verschwinden des Graphical User Interfaces
Ready or not: No UI vom Verschwinden des Graphical User Interfaces
 
Avoid code duplication! Principles & Patterns
Avoid code duplication! Principles & PatternsAvoid code duplication! Principles & Patterns
Avoid code duplication! Principles & Patterns
 
Systementwurf mit UML
Systementwurf mit UMLSystementwurf mit UML
Systementwurf mit UML
 
How to build more reliable, robust and scalable distributed systems
How to build more reliable, robust and scalable distributed systemsHow to build more reliable, robust and scalable distributed systems
How to build more reliable, robust and scalable distributed systems
 
Anforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML GrundlagenAnforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML Grundlagen
 
Domain Driven Design und Nosql
Domain Driven Design und Nosql Domain Driven Design und Nosql
Domain Driven Design und Nosql
 
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionierenMobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
 
The Single Responsibility Principle
The Single Responsibility PrincipleThe Single Responsibility Principle
The Single Responsibility Principle
 
Publish & Subscribe to events using an Event Aggregator
Publish & Subscribe to events using an Event AggregatorPublish & Subscribe to events using an Event Aggregator
Publish & Subscribe to events using an Event Aggregator
 
Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8
 
Domain-driven design - eine Einführung
Domain-driven design - eine EinführungDomain-driven design - eine Einführung
Domain-driven design - eine Einführung
 
SwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
SwissICT Fachgruppe UX: Definition und Bedeutung von User ExperienceSwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
SwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBus
 
Beyond GUI - Die Zukunft digitaler Interfaces
Beyond GUI - Die Zukunft digitaler InterfacesBeyond GUI - Die Zukunft digitaler Interfaces
Beyond GUI - Die Zukunft digitaler Interfaces
 
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
 

Similar to Introduction to FluentData - The Micro ORM

Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...
Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...
Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...
WSO2
 
AWS Total Cost of Ownership Hong Kong and Taiwan
AWS Total Cost of Ownership Hong Kong and TaiwanAWS Total Cost of Ownership Hong Kong and Taiwan
AWS Total Cost of Ownership Hong Kong and Taiwan
Amazon Web Services
 

Similar to Introduction to FluentData - The Micro ORM (20)

Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technology
 
Self-Driving Data Center
Self-Driving Data CenterSelf-Driving Data Center
Self-Driving Data Center
 
Orchestration & Deployment Options for Hybrid Enterprise Environments (ARC310...
Orchestration & Deployment Options for Hybrid Enterprise Environments (ARC310...Orchestration & Deployment Options for Hybrid Enterprise Environments (ARC310...
Orchestration & Deployment Options for Hybrid Enterprise Environments (ARC310...
 
New Enterprise Cloud Database Options for 2019
New Enterprise Cloud Database Options for 2019New Enterprise Cloud Database Options for 2019
New Enterprise Cloud Database Options for 2019
 
Layered Software Architecture
Layered Software ArchitectureLayered Software Architecture
Layered Software Architecture
 
Single Source of Truth for Network Automation
Single Source of Truth for Network AutomationSingle Source of Truth for Network Automation
Single Source of Truth for Network Automation
 
Digital Reinvention by NRB
Digital Reinvention by NRBDigital Reinvention by NRB
Digital Reinvention by NRB
 
Evolving the Network Automation Journey from Python to Platforms
Evolving the Network Automation Journey from Python to PlatformsEvolving the Network Automation Journey from Python to Platforms
Evolving the Network Automation Journey from Python to Platforms
 
LIVO Presentation by ENO
LIVO Presentation by ENOLIVO Presentation by ENO
LIVO Presentation by ENO
 
Oracle Cloud Reference Architecture
Oracle Cloud Reference ArchitectureOracle Cloud Reference Architecture
Oracle Cloud Reference Architecture
 
Proposte ORACLE per la modernizzazione del Datacenter e delle infrastrutture IT
Proposte ORACLE per la modernizzazione del Datacenter e delle infrastrutture ITProposte ORACLE per la modernizzazione del Datacenter e delle infrastrutture IT
Proposte ORACLE per la modernizzazione del Datacenter e delle infrastrutture IT
 
Break Free from Oracle
Break Free from OracleBreak Free from Oracle
Break Free from Oracle
 
Updates to Apache CloudStack and LINBIT SDS
Updates to Apache CloudStack and LINBIT SDSUpdates to Apache CloudStack and LINBIT SDS
Updates to Apache CloudStack and LINBIT SDS
 
EDB & ELOS Technologies - Break Free from Oracle
EDB & ELOS Technologies - Break Free from OracleEDB & ELOS Technologies - Break Free from Oracle
EDB & ELOS Technologies - Break Free from Oracle
 
Euro IT Group
Euro IT GroupEuro IT Group
Euro IT Group
 
Optimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWSOptimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWS
 
Rightscale Webinar: Designing Private & Hybrid Clouds (Hosted by Citrix)
Rightscale Webinar: Designing Private & Hybrid Clouds (Hosted by Citrix)Rightscale Webinar: Designing Private & Hybrid Clouds (Hosted by Citrix)
Rightscale Webinar: Designing Private & Hybrid Clouds (Hosted by Citrix)
 
Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...
Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...
Roadmap to the Clouds - How to Easily Migrate to the Cloud Platform Using WSO...
 
Session
SessionSession
Session
 
AWS Total Cost of Ownership Hong Kong and Taiwan
AWS Total Cost of Ownership Hong Kong and TaiwanAWS Total Cost of Ownership Hong Kong and Taiwan
AWS Total Cost of Ownership Hong Kong and Taiwan
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Introduction to FluentData - The Micro ORM

  • 1. Introduction to FluentData Lars-Erik Kindblad Senior Consultant Blog: kindblad.com
  • 2. Agenda  What is FluentData?  Why was FluentData created?  Architecture  Sample code  Road map | Sector, Alliance, Offering
  • 3. What is FluentData?  Micro ORM for .NET  Makes it simple to query a relational database  Open Source  MIT license  http://fluentdata.codeplex.com  NuGet: FluentData | Sector, Alliance, Offering
  • 4. Why was FluentData created?  ORMs such as Entity Framework and NHibernate have too many disadvantages • Framework is too complex • Forces you to design the .NET Model in a special way by using attributes and ORM Framework specific types • Hard to define the mapping between the database model and business model • A lot of mapping code/XML – not any less code than SQL and manual mapping • Uses an abstracted query language instead of SQL o Hard to do complex queries, Generates poor SQL, Slow • Takes a long time to learn and master • Drag and drop designers are buggy and limiting • = Leads to unpredictable development time and performance  ... had to be a better way to do it | Sector, Alliance, Offering
  • 5. Alternatives to ORMs?  ADO.NET • Powerful • Flexible • Great performance • ... but too much manual code | Sector, Alliance, Offering
  • 6. A Better Alternative? ORM Micro ORM ADO.NET Secure Fast Auto mapping Simple Flexible Fast Predictable Flexible Manual mapping Predictable Secure Auto mapping Manual mapping | Sector, Alliance, Offering
  • 7. Micro ORM  Uses SQL – the native and optimized query language for databases, rock solid – in use since the 70s  Thin wrapper layer on top of ADO.NET: • Reduce repetitive code • Support auto mapping  Map per query instead of per Entity  = Result • Fast • Simple • Efficient | Sector, Alliance, Offering
  • 8. Goals of FluentData  Easy to learn  Simple and efficient to use  Fast  Secure  Single DLL  Only the Data Access Layer should be affected by FluentData  Select queries should be SQL, insert, update and delete queries can be SQL or generated  Support the major databases | Sector, Alliance, Offering
  • 9. Features  Fluent API  Supports SQL Server, SQL Server Compact, SQL Azure, Access, MySQL, Oracle  Use SQL to select data and builders to insert, update, delete data  Supports • Auto mapping and custom mapping • Stored Procedures • Transactions • Multiple result sets • Custom collections eg. ProductCollection instead of List<Product> • Provider model • ++ | Sector, Alliance, Offering
  • 10. Architecture | Sector, Alliance, Offering
  • 11. DbContext  Starting point for working with FluentData  Use it to define settings such as • ConnectionString or ConnectionStringName • UseTransaction  Hook up your own method to any of the supported events • OnConnectionOpened • OnConnectionOpening • OnConnectionClosed • OnExecuting • OnExecuted • OnError | Sector, Alliance, Offering
  • 12. DbCommand  Responsible for performing the actually query against the database | Sector, Alliance, Offering
  • 13. Mapping  FluentData can automap query results to your own entity type or to a dynamic type (new in .NET 4.0)  or you can map the query results manually | Sector, Alliance, Offering
  • 14. Builders  Fluent API to generate SQL for insert, update and delete queries | Sector, Alliance, Offering
  • 16. Getting started  Download FluentData.dll from either • FluentData.CodePlex.com • NuGet  Add a reference to FluentData.dll in your Data Access Project | Sector, Alliance, Offering
  • 17. Model Database .NET | Sector, Alliance, Offering
  • 18. Create and Initialize the DbContext | Sector, Alliance, Offering
  • 19. INSERT DATA | Sector, Alliance, Offering
  • 20. Insert a Category SQL Builder | Sector, Alliance, Offering
  • 21. UPDATE DATA | Sector, Alliance, Offering
  • 22. Update a Product | Sector, Alliance, Offering
  • 23. DELETE DATA | Sector, Alliance, Offering
  • 24. Delete a Product | Sector, Alliance, Offering
  • 25. SELECT DATA | Sector, Alliance, Offering
  • 26. Select a Category | Sector, Alliance, Offering
  • 27. Select all Categories Map to List<Category> Map to CategoryCollection | Sector, Alliance, Offering
  • 28. Select all Products with the related Category Auto Mapping | Sector, Alliance, Offering
  • 29. Select all Products with the related Category Manual Mapping | Sector, Alliance, Offering
  • 30. Count the number of Products | Sector, Alliance, Offering
  • 31. Select All Categories + All Products | Sector, Alliance, Offering
  • 32. Select Products 1,2,3,4 | Sector, Alliance, Offering
  • 33. TRANSACTIONS | Sector, Alliance, Offering
  • 34. Insert multiple products within a Transaction | Sector, Alliance, Offering
  • 35. Road map  Add support for more databases • SQLite, PostgreSQL +  Add a Select Builder with Paging support and strongly typed auto mapping  Simplify code  Single Source File  Performance improvements  .NET intellisense for the database model | Sector, Alliance, Offering
  • 36. QUESTIONS? | Sector, Alliance, Offering
  • 37. www.capgemini.com The information contained in this presentation is proprietary. ©2010 Capgemini. All rights reserved