I've been searching for an example on how to connect to a MySql database and use F# type providers but I could not find anything online.
Can anyone give me a clue? What - if any - extra packages do I need? Do I use SqlDataConnection
or SqlEntityConnection
.
Excuse my ignorance but I'm totally lost. Any and all help is appreciated. I love the idea of type providers and have a fair amount of experience with functional programing but it's the setup around this that gets me.
https://fsprojects.github.io/SQLProvider/
I think I actually got it to work!! Here's what I did:
Then I was able to use SqlEntityConnection and get the types!
There's gotta be an easier way to do this though. I particular, adding stuff to the GAC should not be a part of all this process. I mean, am I asking to much for this to work pretty much "out of the box"?!
Unfortunately, I'm extremely unfamiliar with .Net yet, so I couldn't get the whole thing working with the App.config file. Based on my searches here, it looks like I'm not the only one having troubles with this. If anyone has any feedback/suggestions please help!
I haven't tested this, but if Entity Framework works with MySql (it does) and if F# has an Entity Framework Type Provider (it does) then I would expect the Entity Framework Type Provider to work with MySql.
Have you tried that approach?
I don't think there is out-of-the box type provider that would work with MySQL at the moment. However, Ross McKinlay has been working on a better type provider for SQL databases (more generally). It currently works with MS SQL server and SQL Lite.
It should be possible to write an extension to support MySQL with fairly small amount of work (but sadly, it has not been done yet). See his blog for details. I'm sure that contributions are welcome!
If you are still interested, I recently added support for MySQL to my SQL type provider, help with testing would be good!