diff --git a/SQLProvider.sln b/SQLProvider.sln index 9a3207083..0df52a2c0 100644 --- a/SQLProvider.sln +++ b/SQLProvider.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{14373A98-84EF-4EE2-A4E8-96DEE9FF5BEA}" ProjectSection(SolutionItems) = preProject @@ -27,6 +27,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{C7E85487-9 docs\content\core\crud.fsx = docs\content\core\crud.fsx docs\content\core\general.fsx = docs\content\core\general.fsx docs\content\core\individuals.fsx = docs\content\core\individuals.fsx + docs\content\core\mappers.fsx = docs\content\core\mappers.fsx docs\content\core\msaccess.fsx = docs\content\core\msaccess.fsx docs\content\core\mssql.fsx = docs\content\core\mssql.fsx docs\content\core\mysql.fsx = docs\content\core\mysql.fsx diff --git a/docs/content/core/mappers.fsx b/docs/content/core/mappers.fsx index 5d7fa3467..cb001f026 100644 --- a/docs/content/core/mappers.fsx +++ b/docs/content/core/mappers.fsx @@ -18,7 +18,7 @@ let resolutionPath = __SOURCE_DIRECTORY__ + @"/../../files/sqlite" This mapper will get sure that you always sync your types with types you receive from your db. -### First add an Domain Model +First add an Domain Model *) @@ -30,7 +30,7 @@ type Employee = { } (** -### Then you can create the mapper using dataContext to use generated types from db +Then you can create the mapper using dataContext to use generated types from db *) let mapEmployee (dbRecord:sql.dataContext.``main.EmployeesEntity``) : Employee = @@ -38,3 +38,31 @@ let mapEmployee (dbRecord:sql.dataContext.``main.EmployeesEntity``) : Employee = FirstName = dbRecord.FirstName LastName = dbRecord.LastName HireDate = dbRecord.HireDate } + +(** +SqlProvider also has a `.MapTo<'T>` convenience method: +*) + +open System +open FSharp.Data.Sql + +type sql = SqlDataProvider + +let ctx = sql.GetDataContext() + +let orders = ctx.Main.Orders +let employees = ctx.Main.Employees + +type Employee2 = { + FirstName:string + LastName:string + } + +let qry = query { for row in employees do + select row} |> Seq.map (fun x -> x.MapTo()) + + + diff --git a/docs/content/index.fsx b/docs/content/index.fsx index 9171d56b9..18ca613f2 100644 --- a/docs/content/index.fsx +++ b/docs/content/index.fsx @@ -10,14 +10,14 @@ A general .NET/Mono SQL database type provider. Current features: * [LINQ queries](core/querying.html) * Lazy schema exploration * Automatic constraint navigation -* [Individuals](Individuals.html) +* [Individuals](core/Individuals.html) * Transactional [CRUD](core/crud.html) operations with identity support * [Stored Procedures](core/programmability.html) * [Functions](core/programmability.html) * Packages (Oracle) -* [Composable Query](core/composable.html) integration +* [Composable Query](composable.html) integration * Optional option types -* Mapping to record types +* [Mapping to record types](core/mappers.html) * Custom Operators * Supports [Asynchronous Operations](core/async.html) @@ -106,7 +106,7 @@ let mattisOrderDetails = Samples & documentation ----------------------- -The library comes with comprehensible documentation. +The library comes with comprehensive documentation. * [General](core/general.html) a high level view on the type providers' abilities and limitations * [Static Parameters](core/parameters.html) available static parameters @@ -116,6 +116,7 @@ The library comes with comprehensible documentation. * [Programmability](core/programmability.html) usage and limitations of stored procedures and functions * [Individuals](core/individuals.html) usage and limitations of this unique feature * [Composable Query](core/composable.html) information on integrating this project with the SQL provider + * [Mapping to record types](core/mappers.html) * [API Reference](reference/index.html) contains automatically generated documentation for all types, modules and functions in the library. diff --git a/docs/files/msaccess/Northwind.MDB b/docs/files/msaccess/Northwind.MDB index e38801e85..445640272 100644 Binary files a/docs/files/msaccess/Northwind.MDB and b/docs/files/msaccess/Northwind.MDB differ diff --git a/tests/SqlProvider.Tests/db/northwindEF.db b/tests/SqlProvider.Tests/db/northwindEF.db index 535d5c1d1..afb332fda 100644 Binary files a/tests/SqlProvider.Tests/db/northwindEF.db and b/tests/SqlProvider.Tests/db/northwindEF.db differ