SQL Server and F# Series
source link: https://www.compositional-it.com/news-blog/sql-server-and-f-series/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
SQL Server and F# Series
In this blog, Akash sets the scene for his upcoming SQL Server series and gives a sneak peek of what to expect! 👀
Coming from a JavaScript background, my go-to choice for storage was MongoDB. It was quick and easy to setup and worked nicely with JavaScript's dynamic nature. Having never used SQL storage, I felt I was missing a vital understanding as to why things like Mongo even existed.
When I started at Compositional IT, where we often use SQL Server, I got the chance to improve my SQL knowledge. I wasn't sure where to start, and as always the F# community have done an incredible job at providing so many different technologies to choose from.
In this blog series I plan to go through some of the most popular F# SQL data access layers and some that may be new to you!
I'll be using the same domain for each technology. That way we'll gain familiarity with the code and can focus on the data side of things. I've tried to include as many F# features as possible, such as Single cased unions and Options, without overcomplicating the design to see how each technology handles the mapping.
Domain
type PokemonTrainerId = PokemonTrainerId of string
type PokemonId = PokemonId of string
type PokemonType =
| Rock
| Grass
| Poison
| Fire
| Psychic
| Ghost
| Ice
type PokemonType_Pokemon =
{ PokemonTypeId: PokemonType; PokemonId: PokemonId }
type Pokemon =
{ Id : PokemonId
PokeIndex : int
Name : string
Level: int
PokemonTypes: PokemonType list
EvolutionName: string option }
type Record =
{ Wins: uint; Losses: uint }
type PokemonTrainer =
{ Id : PokemonTrainerId
Name : string
Pokemon : Pokemon list
Record: Record }
Sneak preview
In my upcoming blogs you can expect to see how F# can be used with:
- Raw ADO.NET
- ADO.NET extensions - Donald
- Micro ORMs - Dapper
- Full ORMs - SQLProvider
- Code generation - Facil
In my next blog we'll set up SQL Server with Visual Studio!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK