SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Rainer Stropek


Custom Odata Providers
Introduction
• You all know what OData is?
  – Short demo to introduce OData?


• You are all familiar with LINQ &
  IQueryable?
  – Short demo to introduce IQueryable?
What is the basic idea of OData and IQueryable regarding database
queries?

ARCHITECTURE
Architecture of C#, OData and IQueryable

Compiler
                                             Generator
              Grammar
                                               rules



                                 Tree
    Source   Lexer, Parser                   Generator   Target
                             (Syntax Tree)




                               Interpreter
Architecture of C#, OData and IQueryable

              C# Compiler                    BCL


    C#                                                 IL



                            Expression
                               Tree


OData Query
  (URI)                                                SQL

                 OData                        Entity
                runtime                    Framework



                            Interpret or
                              rewrite
Typical Architecture




Clients     Load
           Balancer



                                  DB Failover
                      Web Farm     Cluster

                          Cloud
Solution = Sharding




 Clients    Load
           Balancer


                                      DB Load
                      Web Farm    Balancing Cluster
                                     of Failover
                          Cloud       Clusters
How can we build a custom IQueryable?

CUSTOM IQUERYABLE
Custom IQueryable
• Use IQToolkit if possible
• Derive your implementation from
 QueryProvider
• Implement two virtual methods
  – object Execute(Expression expression)
  – string GetQueryText(Expression expression)
   (Optional)
Using Custom IQueryable




• Expression tree is received by query
  provider
• We have to rewrite and run it to all e.g.
  sharding databases
Implement Queryable
• Use .NET‘s visitor pattern to examine and rewrite
  expression tree
• AnalyzeQueryVisitor
   – Verifies that query is ok (e.g. must contain top-clause,
     etc.)
   – Stores reference to e.g. Take and Skip clauses
How can we build a custom OData provider?

CUSTOM ODATA PROVIDER
Custom OData Building Blocks
• Derive from DataService<T>
  – Main entry point for developing a WCF Data Service
• Implement IServiceProvider to provide...
  – ...IDataServiceMetadataProvider
     • Build custom metadata
     • Build OData metadata with e.g. reflection
  – ... IDataServiceQueryProvider
     • Provide an underlying IQueryable for query execution
Workflow for OData Query
(simplified)




               Get metdata
                 service
                Get query
                provider

                       Create data-
                         source

                                 Set current
                                 data source

                        Initialize
                         service                         Get IQueryable
                                                         used for getting   Provide
                                      Resolve resource        data          metdata
                                            set

                                Get query
                             root (IQueryable)
IDataServiceMetadataProvider

• ResourceSet consisting of ResourceType
 objects (=entity types)
• CustomDataServiceMetadataProvider is a
 simple generic implementation of
 IDataServiceMetadataProvider
IDataServiceMetadataProvider
public interface IDataServiceMetadataProvider
{
                                                         Service Ops not
     string ContainerName { get; }                        covered here
     string ContainerNamespace { get; }

    IEnumerable<ResourceSet> ResourceSets { get; }
    IEnumerable<ServiceOperation> ServiceOperations { get; }
    IEnumerable<ResourceType> Types { get; }

    IEnumerable<ResourceType> GetDerivedTypes(ResourceType resourceType);
    ResourceAssociationSet GetResourceAssociationSet(
         ResourceSet resourceSet, ResourceType resourceType,
         ResourceProperty resourceProperty);
    bool HasDerivedTypes(ResourceType resourceType);
    bool TryResolveResourceSet(string name, out ResourceSet resourceSet);
    bool TryResolveResourceType(string name, out ResourceType resourceType);
    bool TryResolveServiceOperation(string name,
         out ServiceOperation serviceOperation);
}
IDataServiceQueryProvider

• Provides root IQueryable for a given
  resource set
• CustomDataServiceProvider is a simple
  generic implementation of
 IDataServiceQueryProvider
IDataServiceQueryProvider
public interface IDataServiceQueryProvider
{
     object CurrentDataSource { get; set; }
     bool IsNullPropagationRequired { get; }

    object GetOpenPropertyValue(object target, string propertyName);
    IEnumerable<KeyValuePair<string, object>> GetOpenPropertyValues(
         object target);
    object GetPropertyValue(object target,
         ResourceProperty resourceProperty);
    IQueryable GetQueryRootForResourceSet(ResourceSet resourceSet);
    ResourceType GetResourceType(object target);
    object InvokeServiceOperation(ServiceOperation serviceOperation,
         object[] parameters);
}
Linking Custom OData & Custom LINQ Provider
Further Reading

http://www.software-architects.com

Weitere ähnliche Inhalte

Was ist angesagt?

Squeak DBX
Squeak DBXSqueak DBX
Squeak DBXESUG
 
Hibernate
Hibernate Hibernate
Hibernate Sunil OS
 
JavaFX and Scala in the Cloud
JavaFX and Scala in the CloudJavaFX and Scala in the Cloud
JavaFX and Scala in the CloudStephen Chin
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSencha
 
Create custom looping procedures in sql server 2005 tech republic
Create custom looping procedures in sql server 2005   tech republicCreate custom looping procedures in sql server 2005   tech republic
Create custom looping procedures in sql server 2005 tech republicKaing Menglieng
 
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介scalaconfjp
 
Multithreading and Parallelism on iOS [MobOS 2013]
 Multithreading and Parallelism on iOS [MobOS 2013] Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]Kuba Břečka
 
Clojure - An Introduction for Java Programmers
Clojure - An Introduction for Java ProgrammersClojure - An Introduction for Java Programmers
Clojure - An Introduction for Java Programmerselliando dias
 
Java Future S Ritter
Java Future S RitterJava Future S Ritter
Java Future S Rittercatherinewall
 
Connect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneConnect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneHoward Greenberg
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一scalaconfjp
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling RewriterJustin Edelson
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at TwitterAlex Payne
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat Roque
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not JavaChris Adamson
 

Was ist angesagt? (20)

55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBX
 
Hibernate
Hibernate Hibernate
Hibernate
 
JavaFX and Scala in the Cloud
JavaFX and Scala in the CloudJavaFX and Scala in the Cloud
JavaFX and Scala in the Cloud
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
 
Create custom looping procedures in sql server 2005 tech republic
Create custom looping procedures in sql server 2005   tech republicCreate custom looping procedures in sql server 2005   tech republic
Create custom looping procedures in sql server 2005 tech republic
 
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
 
Multithreading and Parallelism on iOS [MobOS 2013]
 Multithreading and Parallelism on iOS [MobOS 2013] Multithreading and Parallelism on iOS [MobOS 2013]
Multithreading and Parallelism on iOS [MobOS 2013]
 
Clojure - An Introduction for Java Programmers
Clojure - An Introduction for Java ProgrammersClojure - An Introduction for Java Programmers
Clojure - An Introduction for Java Programmers
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 
Java Future S Ritter
Java Future S RitterJava Future S Ritter
Java Future S Ritter
 
Connect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneConnect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast Lane
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not Java
 
Kotlin talk
Kotlin talkKotlin talk
Kotlin talk
 

Ähnlich wie BASTA 2013: Custom OData Provider

Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL SystemsStrudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systemstatemura
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternNitin Bhide
 
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaUsing the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaArun Gupta
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufCTE Solutions Inc.
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsPushkar Chivate
 
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...Juarez Junior
 
BarcelonaJUG - Revolutionize Java Database Application Development with React...
BarcelonaJUG - Revolutionize Java Database Application Development with React...BarcelonaJUG - Revolutionize Java Database Application Development with React...
BarcelonaJUG - Revolutionize Java Database Application Development with React...Juarez Junior
 
Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']Jan Helke
 
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...Juarez Junior
 
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...Juarez Junior
 
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual ThreadsDWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual ThreadsJuarez Junior
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Modelkunj desai
 
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...Juarez Junior
 

Ähnlich wie BASTA 2013: Custom OData Provider (20)

Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL SystemsStrudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
 
40020
4002040020
40020
 
40020
4002040020
40020
 
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaUsing the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian Malbeuf
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure tools
 
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
 
BarcelonaJUG - Revolutionize Java Database Application Development with React...
BarcelonaJUG - Revolutionize Java Database Application Development with React...BarcelonaJUG - Revolutionize Java Database Application Development with React...
BarcelonaJUG - Revolutionize Java Database Application Development with React...
 
Oracle sql demo
Oracle sql demoOracle sql demo
Oracle sql demo
 
Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']Bye bye $GLOBALS['TYPO3_DB']
Bye bye $GLOBALS['TYPO3_DB']
 
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
 
What's New in Apache Hive
What's New in Apache HiveWhat's New in Apache Hive
What's New in Apache Hive
 
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
 
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual ThreadsDWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
DWX23 - Revolutionize Java DB AppDev with Reactive Streams and Virtual Threads
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 
Data access
Data accessData access
Data access
 
Data In Cloud
Data In CloudData In Cloud
Data In Cloud
 
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
CloudLand - Revolutionize Java DB AppDev with Reactive Streams and Virtual Th...
 

Kürzlich hochgeladen

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
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
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
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
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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!
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

BASTA 2013: Custom OData Provider

  • 2. Introduction • You all know what OData is? – Short demo to introduce OData? • You are all familiar with LINQ & IQueryable? – Short demo to introduce IQueryable?
  • 3. What is the basic idea of OData and IQueryable regarding database queries? ARCHITECTURE
  • 4. Architecture of C#, OData and IQueryable Compiler Generator Grammar rules Tree Source Lexer, Parser Generator Target (Syntax Tree) Interpreter
  • 5. Architecture of C#, OData and IQueryable C# Compiler BCL C# IL Expression Tree OData Query (URI) SQL OData Entity runtime Framework Interpret or rewrite
  • 6. Typical Architecture Clients Load Balancer DB Failover Web Farm Cluster Cloud
  • 7. Solution = Sharding Clients Load Balancer DB Load Web Farm Balancing Cluster of Failover Cloud Clusters
  • 8. How can we build a custom IQueryable? CUSTOM IQUERYABLE
  • 9. Custom IQueryable • Use IQToolkit if possible • Derive your implementation from QueryProvider • Implement two virtual methods – object Execute(Expression expression) – string GetQueryText(Expression expression) (Optional)
  • 10. Using Custom IQueryable • Expression tree is received by query provider • We have to rewrite and run it to all e.g. sharding databases
  • 11. Implement Queryable • Use .NET‘s visitor pattern to examine and rewrite expression tree • AnalyzeQueryVisitor – Verifies that query is ok (e.g. must contain top-clause, etc.) – Stores reference to e.g. Take and Skip clauses
  • 12. How can we build a custom OData provider? CUSTOM ODATA PROVIDER
  • 13. Custom OData Building Blocks • Derive from DataService<T> – Main entry point for developing a WCF Data Service • Implement IServiceProvider to provide... – ...IDataServiceMetadataProvider • Build custom metadata • Build OData metadata with e.g. reflection – ... IDataServiceQueryProvider • Provide an underlying IQueryable for query execution
  • 14. Workflow for OData Query (simplified) Get metdata service Get query provider Create data- source Set current data source Initialize service Get IQueryable used for getting Provide Resolve resource data metdata set Get query root (IQueryable)
  • 15. IDataServiceMetadataProvider • ResourceSet consisting of ResourceType objects (=entity types) • CustomDataServiceMetadataProvider is a simple generic implementation of IDataServiceMetadataProvider
  • 16. IDataServiceMetadataProvider public interface IDataServiceMetadataProvider { Service Ops not string ContainerName { get; } covered here string ContainerNamespace { get; } IEnumerable<ResourceSet> ResourceSets { get; } IEnumerable<ServiceOperation> ServiceOperations { get; } IEnumerable<ResourceType> Types { get; } IEnumerable<ResourceType> GetDerivedTypes(ResourceType resourceType); ResourceAssociationSet GetResourceAssociationSet( ResourceSet resourceSet, ResourceType resourceType, ResourceProperty resourceProperty); bool HasDerivedTypes(ResourceType resourceType); bool TryResolveResourceSet(string name, out ResourceSet resourceSet); bool TryResolveResourceType(string name, out ResourceType resourceType); bool TryResolveServiceOperation(string name, out ServiceOperation serviceOperation); }
  • 17. IDataServiceQueryProvider • Provides root IQueryable for a given resource set • CustomDataServiceProvider is a simple generic implementation of IDataServiceQueryProvider
  • 18. IDataServiceQueryProvider public interface IDataServiceQueryProvider { object CurrentDataSource { get; set; } bool IsNullPropagationRequired { get; } object GetOpenPropertyValue(object target, string propertyName); IEnumerable<KeyValuePair<string, object>> GetOpenPropertyValues( object target); object GetPropertyValue(object target, ResourceProperty resourceProperty); IQueryable GetQueryRootForResourceSet(ResourceSet resourceSet); ResourceType GetResourceType(object target); object InvokeServiceOperation(ServiceOperation serviceOperation, object[] parameters); }
  • 19. Linking Custom OData & Custom LINQ Provider