FSharp.Data.TypeProviders


The SqlEntityConnection Type Provider (FSharp.Data.TypeProviders)

Please see Walkthrough: Accessing a SQL Database by Using Type Providers and Entities

NOTE: Use FSharp.Data.TypeProviders instead of Microsoft.FSharp.Data.TypeProviders

Reference

Please see the MSDN Documentation

Example

Please see Walkthrough: Accessing a SQL Database by Using Type Providers and Entities

See also below for a micro example use of the type provider:

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
#r "System.Data.Entity"
#r "FSharp.Data.TypeProviders.dll"
open FSharp.Data.TypeProviders

// The database connection string
let [<Literal>] CONN = @"AttachDBFileName = 'C:\GitHub\fsprojects\FSharp.Data.TypeProviders\tests\FSharp.Data.TypeProviders.Tests\SqlDataConnection\DB\NORTHWND.MDF';Server='(localdb)\MSSQLLocalDB'"

// Connect to the database at compile-time
type Northwnd = SqlEntityConnection<CONN>

// Connect to the database at runtime
let ctxt = Northwnd.GetDataContext()

// Execute a query
let categories = 
    query { for d in ctxt.Categories do
            where (d.CategoryID > 10)
            select (d.CategoryName, d.Description) } 
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Data

--------------------
namespace Microsoft.FSharp.Data
namespace FSharp.Data.TypeProviders
Multiple items
type LiteralAttribute =
  inherit Attribute
  new : unit -> LiteralAttribute

Full name: Microsoft.FSharp.Core.LiteralAttribute

--------------------
new : unit -> LiteralAttribute
val CONN : string

Full name: Sqlentity.CONN
type Northwnd

Full name: Sqlentity.Northwnd
type SqlEntityConnection

Full name: FSharp.Data.TypeProviders.SqlEntityConnection


<summary>Provides the types to access a database, using a LINQ-to-Entities mapping</summary><param name='ConnectionString'>The connection string for the database connection</param><param name='ConnectionStringName'>The name of the connection string for the database connection in the configuration file.</param><param name='LocalSchemaFile'>The local file for the database schema</param><param name='Provider'>The name of the ADO.NET data provider to be used for ssdl generation (default: System.Data.SqlClient)</param><param name='EntityContainer'>The name to use for the EntityContainer in the conceptual model</param><param name='ConfigFile'>The name of the configuration file used for connection strings (default: app.config or web.config is used)</param><param name='DataDirectory'>The name of the data directory, used to replace |DataDirectory| in connection strings (default: the project or script directory)</param><param name='ResolutionFolder'>The folder used to resolve relative file paths at compile-time (default: folder containing the project or script)</param><param name='ForceUpdate'>Require that a direct connection to the database be available at design-time and force the refresh of the local schema file (default: true)</param><param name='Pluralize'>Automatically pluralize or singularize class and member names using English language rules (default: false)</param><param name='SuppressForeignKeyProperties'>Exclude foreign key properties in entity type definitions (default: false)</param>
val ctxt : obj

Full name: Sqlentity.ctxt
val categories : System.Linq.IQueryable<obj * obj>

Full name: Sqlentity.categories
val query : Linq.QueryBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.query
val d : obj
custom operation: where (bool)

Calls Linq.QueryBuilder.Where
custom operation: select ('Result)

Calls Linq.QueryBuilder.Select
Fork me on GitHub