Valdis Iljuconoks - Loving data with F#

Post on 13-May-2015

199 views 6 download

Tags:

transcript

Partners:

Valdis Iļjučonoks

Technical Fellow, Software ArchitectVisual Studio ALM evangelistMicrosoft MVP

http://www.tech-fellow.net | @tech_fellow

Geta AS, Tech Fellow Consulting, Latvian .Net UGvaldis.iljuconoks@outlook.com

Loving data with F#

Valdis Iļjučonoks

There are three kinds of lies: lies,damned lies, and statistics.

-- Benjamin Disraeli

Information rich programming

Bring data source closer to program

Barrier to include data sources: Need to represent data as types, properties and methods Generated code must be replaced every time service

reference is adjusted

Type Providers

From1k feet: Compile-time type provider Erased or generated types approach Data set schema as type info source

Driven by F# team and community

DbmlFileEdmxFile

ODataServiceSqlDataConnectionSqlEntityConnection

WsdlServiceAppSettings

ExcelGraph

MachineManagement

MathRegexXamlXrm

ApiaryCsv

FreebaseJson

WorldBankXml

DGMLWordCsv

DataStoreHadoop/Hive/Hdfs

HelloWorldManagement

MiniCvsXrm

FunScript…

{Demo image}

Json Provider

WorldBank Provider

Xml Provider

OData Service Provider

Is it worth to develop custom provider?

Is schema available? Will provider have enough usage it’s worthwhile to write? Will schema change during coding? Will it change during program execution?

Authoring TypeProvider

Uses F# Code Quotations AddMember() AddMemberDelayed()

let staticProp = ProvidedProperty(propertyName = "StaticProperty", propertyType = typeof<string>, IsStatic = true, GetterCode = (fun args -> <@@ "Hello!" @@>))

staticProp.AddXmlDocDelayed(fun () -> "This is a static property")

t.AddMember staticProp

let t = ProvidedTypeDefinition(thisAssembly,namespaceName, "Type" + string n, baseType = Some typeof<obj>)

Type Providers

Bring data source closer to program

Feedback

Partners: