What SqlHydra generates from your database schema
mainSqlHydra.Cli reads your database schema and generates an F# file containing:
- F# record types: One for each table. Nullable columns are automatically mapped to
Optiontypes. - Table declarations: Used to reference tables within
selectTaskblocks. QueryContextFactory: A factory with a staticCreate(connectionString: string)method to initialize your database connection.
Example of generated code:
module SalesLT =
type Product =
{ ProductID: int
Name: string
ListPrice: decimal
Color: string option } // nullable columns become Option
let Product = table<Product> // table declaration for queriesmodule SalesLT =
type Product =
{ ProductID: int
Name: string
ListPrice: decimal
Color: string option }
let Product = table<Product>