File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ layout : doc
3+ title : Entity Framework 6
4+ ---
5+
6+ Npgsql has an Entity Framework 6 provider. You can use it by installing the
7+ [ EntityFramework6.Npgsql] ( https://www.nuget.org/packages/EntityFramework6.Npgsql/ ) nuget.
8+
9+ ## Guid Support ##
10+
11+ Npgsql EF migrations support uses ` uuid_generate_v4() ` function to generate guids.
12+ In order to have access to this function, you have to install the extension uuid-ossp through the following command:
13+
14+ ``` sql
15+ create extension " uuid-ossp" ;
16+ ```
17+
18+ If you don't have this extension installed, when you run Npgsql migrations you will get the following error message:
19+
20+ ```
21+ ERROR: function uuid_generate_v4() does not exist
22+ ```
23+
24+ If the database is being created by Npgsql Migrations, you will need to
25+ [ run the ` create extension ` command in the ` template1 ` database] ( http://stackoverflow.com/a/11584751 ) .
26+ This way, when the new database is created, the extension will be installed already.
27+
28+ ## Template Database ##
29+
30+ When the Entity Framework 6 provider creates a database, it issues a simple ` CREATE DATABASE ` command.
31+ In PostgreSQL, this implicitly uses ` template1 ` as the template - anything existing in ` template1 ` will
32+ be copied to your new database. If you wish to change the database used as a template, you can specify
33+ the ` EF Template Database ` connection string parameter. For more info see the
34+ [ PostgreSQL docs] ( https://www.postgresql.org/docs/current/static/sql-createdatabase.html ) .
Original file line number Diff line number Diff line change 1+ # [ Getting Started] ( index.md )
You can’t perform that action at this time.
0 commit comments