The blog of the F# team at Microsoft
[ Update: the CRM type provider is now available as the FSharpx.TypeProviders.Xrm NuGet package. The namespace has changed from "Samples" to "FSharpx" ]
Part 1 - The Microsoft Dynamics CRM Type Provider SamplePart 2 - The Microsoft Dynamics CRM Type Provider Sample - Static ParametersPart 3 - The Microsoft Dynamics CRM Type Provider Sample - Updated Functionality
The CRM Type Provider Sample in the F# 3.0 Sample Pack supports several interesting static parameters that determine how CRM is integrated into the F# programming language.
The parameters are as follows:
The service URL for the CRM Organization Service
When true, attributes in CRM that are not required will be surfaced as Nullable<'T>. When false, all value-type, non required attributes will be returned as Unchecked.defaultOf<'T> whether they exist or not
Determines the naming convention of relationship properties used on entity types
When true, Windows Live authentication will be used, allowing access to CRM Online deployments
Path to a plain text file that includes username, password and optionally the domain. In the case of CRM Online these would be the relevant Windows Live username and password
Can be used in explorative scripting scenarios instead of a credentials file
The maximum number of sample individuals for each CRM entity set
Controls the behaviour of data bound entities
Some further rules of the authentication configuration are as follows:
Of the static parameters only the service URL is required. You can supply others you need with the named parameter syntax:
type Xrm = XrmDataProvider<"http://server/org/XRMServices/2011/Organization.svc", CredentialsFile="Credentials.txt">
let dc = Xrm.GetDataContext()
This first release is an excellent take of contact, but if we want to use as alternative of the C# language we need to include new features like joins, in fact the limitations that you said on last post:
• Explicit joins are not implemented
• Many to many relationships to/from the same entity type are not implemented
• Aggregation operations are not implemented
• No support for formatted values and option set types is implemented
• There are some restrictions with the way parents / children can be selected (more on this in later posts)
• The provider is designed thus far to extract data, not push data back in. Whilst the resulting entities can be used like any normal CRM entity, you may not use the strongly typed attributes and relationships to modify or create new data. You can however still use the underlying Entity object like normal for this purpose.
• A connection to the organization service is required during compilation
Do you have any intention to continue improvement this great Type Provider?
Isn't there a problem with the latest version (some issues because of renaming)?
*** I got the latest page with help of NuGet:
PM> Install-Package FSharpx.TypeProviders.Xrm
Successfully installed 'FSharpx.TypeProviders.Xrm 1.7.11'.
Successfully added 'FSharpx.TypeProviders.Xrm 1.7.11' to ConsoleApplicationXrm.
*** I added code as described:
let main argv =
let url = "http://[FQDN_TO_SERVER]/[ORGANIZATION]/XRMServices/2011/Organization.svc"
let user = "[USERNAME]"
let password = "[PASSWORD]"
let domain = "[DOMAIN]"
let xrm_ = XrmDataProvider<
OrganizationServiceUrl = url,
Username = user,
Password = password,
Domain = domain >.GetDataContext(url, user, password, domain, false)
let accounts = xrm.account
*** But I get this error. I suppose is regarding the renaming from Sample to FSharpx:
Error 1 The type provider 'FSharpx.TypeProviders.XrmProvider.XrmTypeProvider' reported an error: Member Samples.FSharp.ProvidedTypes.ProvidedConstructor is of unexpected type C:\_tfs\_xprototypes\ConsoleApplicationXrm\ConsoleApplicationXrm\Program.fs 33 5 ConsoleApplicationXrm
Hope you can help and keep up the good work guys :D
please try 1.7.12 from nuget.
Hello Ramón , the bug you reported is now fixed, there is a new version of the nuget package : FSharpx.TypeProviders.Xrm 1.7.12
Some code had got out of sync between the various repositories, thanks for the bug report.