A general .NET/Mono SQL database type provider. Current features:
- LINQ queries
- Lazy schema exploration
- Automatic constraint navigation
- Transactional CRUD operations with identity support
- Stored Procedures
- Packages (Oracle)
- Composable Query integration
- Optional option types
- Mapping to record types
- Custom Operators
- Supports Asynchronous Operations
- Supports .NET Standard / .NET Core
- Supports saving DB schema offline, and SQL-Server *.dacpac files
The provider currently has explicit implementations for the following database vendors:
- SQL Server
- SQL Server SSDT
There is also an ODBC provider that will let you connect to any ODBC source with limited features.
All database vendors except SQL Server and MS Access will require 3rd party ADO.NET connector objects to function. These are dynamically loaded at runtime so that the SQL provider project is not dependent on them. You must supply the location of the assemblies with the "ResolutionPath" static parameter.
SQLite is based on the .NET drivers found here. You will need the correct version for your specific architecture and setup.
PostgreSQL is based on the Npgsql .NET drivers found here. The type provider will make frequent calls to the database. Npgsql provides a set of performance related connection strings parameters for tweaking its performance
MySQL is based on the .NET drivers found here. You will need the correct version for your specific architecture and setup. You also need to specify ResolutionPath, which points to the folder containing the dll files for the MySQL driver.
Oracle is based on the current release (188.8.131.52.2) of the managed ODP.NET driver found here. However, although the managed version is recommended, it should also work with previous versions of the native driver.
SQL Server SSDT is based on the current release (160.20216.14) found here.
This example demonstrates the use of the SQL type provider:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
The library comes with comprehensive documentation.
- General a high level view on the type providers' abilities and limitations
- Static Parameters available static parameters
- Querying information on supported LINQ keywords and custom operators with examples
- Relationships how to use automatic constraint navigation in your queries
- CRUD usage and limitations of transactional create - update - delete support
- Programmability usage and limitations of stored procedures and functions
- Individuals usage and limitations of this unique feature
- Composable Query information on integrating this project with the SQL provider
- Mapping to record types
- API Reference contains automatically generated documentation for all types, modules and functions in the library.
Database vendor specific issues and considerations are documented on their separate pages. Please see the menu on the right.
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API, please also consider adding samples that can be turned into a documentation. You might also want to read library design notes to understand how it works. Our tests have more samples. Learn more tech tech details.
The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.
type LiteralAttribute =
new : unit -> LiteralAttribute
new : unit -> LiteralAttribute
<summary>Typed representation of a database</summary>
<param name='ConnectionString'>The connection string for the SQL database</param>
<param name='ConnectionStringName'>The connection string name to select from a configuration file</param>
<param name='DatabaseVendor'> The target database vendor</param>
<param name='IndividualsAmount'>The amount of sample entities to project into the type system for each SQL entity type. Default 1000.</param>
<param name='UseOptionTypes'>If true, F# option types will be used in place of nullable database columns. If false, you will always receive the default value of the column's type even if it is null in the database.</param>
<param name='ResolutionPath'>The location to look for dynamically loaded assemblies containing database vendor specific connections and custom types.</param>
<param name='Owner'>Oracle: The owner of the schema for this provider to resolve. PostgreSQL: A list of schemas to resolve, separated by spaces, newlines, commas, or semicolons.</param>
<param name='CaseSensitivityChange'>Should we do ToUpper or ToLower when generating table names?</param>
<param name='TableNames'>Comma separated table names list to limit a number of tables in big instances. The names can have '%' sign to handle it as in the 'LIKE' query (Oracle and MSSQL Only)</param>
<param name='ContextSchemaPath'>The location of the context schema previously saved with SaveContextSchema. When not empty, will be used to populate the database schema instead of retrieving it from then database.</param>
<param name='OdbcQuote'>Odbc quote characters: Quote characters for the table and column names: `alias`, [alias]</param>
<param name='SQLiteLibrary'>Use System.Data.SQLite or Mono.Data.SQLite or select automatically (SQLite only)</param>
<param name='SsdtPath'>A path to an SSDT .dacpac file.'</param>
| MSSQLSERVER = 0
| SQLITE = 1
| POSTGRESQL = 2
| MYSQL = 3
| ORACLE = 4
| MSACCESS = 5
| ODBC = 6
| FIREBIRD = 7
| MSSQLSERVER_DYNAMIC = 8
| MSSQLSERVER_SSDT = 9