diff --git a/.gitignore b/.gitignore
index adc05e9..f10af03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
*.sln.docstates
*.userprefs
/*.nupkg
+.idea/
.nuget/
[Bb]in/
[Bb]uild/
diff --git a/.teamcity/EntityFramework6Npgsql/buildTypes/EntityFramework6Npgsql_Build.xml b/.teamcity/EntityFramework6Npgsql/buildTypes/EntityFramework6Npgsql_Build.xml
deleted file mode 100644
index 3ae11b0..0000000
--- a/.teamcity/EntityFramework6Npgsql/buildTypes/EntityFramework6Npgsql_Build.xml
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
- Build
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.teamcity/EntityFramework6Npgsql/pluginData/plugin-settings.xml b/.teamcity/EntityFramework6Npgsql/pluginData/plugin-settings.xml
deleted file mode 100644
index 784b770..0000000
--- a/.teamcity/EntityFramework6Npgsql/pluginData/plugin-settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/.teamcity/EntityFramework6Npgsql/project-config.xml b/.teamcity/EntityFramework6Npgsql/project-config.xml
deleted file mode 100644
index 6c2ccfb..0000000
--- a/.teamcity/EntityFramework6Npgsql/project-config.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- EntityFramework6.Npgsql
- Entity Framework 6/5 for PostgreSQL
-
-
-
-
-
-
diff --git a/.teamcity/EntityFramework6Npgsql/vcsRoots/EntityFramework6Npgsql_Github.xml b/.teamcity/EntityFramework6Npgsql/vcsRoots/EntityFramework6Npgsql_Github.xml
deleted file mode 100644
index 7c55983..0000000
--- a/.teamcity/EntityFramework6Npgsql/vcsRoots/EntityFramework6Npgsql_Github.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- https://github.com/npgsql/EntityFramework6.Npgsql.git
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..f1d9f98
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
diff --git a/EntityFramework6.Npgsql.sln.DotSettings b/EntityFramework6.Npgsql.sln.DotSettings
index 78c61b1..5dfab15 100644
--- a/EntityFramework6.Npgsql.sln.DotSettings
+++ b/EntityFramework6.Npgsql.sln.DotSettings
@@ -58,6 +58,7 @@
True
True
True
+ True
True
True
True
diff --git a/doc/index.md b/doc/index.md
index 0a73365..1dd3137 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -6,6 +6,30 @@ title: Entity Framework 6
Npgsql has an Entity Framework 6 provider. You can use it by installing the
[EntityFramework6.Npgsql](https://www.nuget.org/packages/EntityFramework6.Npgsql/) nuget.
+## Basic Configuration ##
+To use Entity Framework with Npgsql, define a class that inherits from `DbConfiguration` in the same assembly as your class inheriting `DbContext`. Ensure that you configure provider services, a provider factory, a default connection factory as shown below:
+
+```csharp
+using Npgsql;
+using System.Data.Entity;
+
+class NpgSqlConfiguration : DbConfiguration
+{
+ public NpgSqlConfiguration()
+ {
+ var name = "Npgsql";
+
+ SetProviderFactory(providerInvariantName: name,
+ providerFactory: NpgsqlFactory.Instance);
+
+ SetProviderServices(providerInvariantName: name,
+ provider: NpgsqlServices.Instance);
+
+ SetDefaultConnectionFactory(connectionFactory: new NpgsqlConnectionFactory());
+ }
+}
+```
+
## Guid Support ##
Npgsql EF migrations support uses `uuid_generate_v4()` function to generate guids.
diff --git a/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj b/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj
index b0bb8ff..243935d 100644
--- a/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj
+++ b/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj
@@ -2,10 +2,10 @@
PostgreSQL provider for Entity Framework 6
Shay Rojansky;Emil Lenngren;Francisco Figueiredo Jr.;Kenji Uno
- Copyright 2018 © The Npgsql Development Team
+ Copyright 2019 © The Npgsql Development Team
Npgsql
npgsql postgresql postgres data database entity framework ef orm
- 3.2.0
+ 3.2.1
latest
net45
true
@@ -18,7 +18,7 @@
true
http://www.npgsql.org
http://www.npgsql.org/img/postgresql.gif
- https://raw.githubusercontent.com/npgsql/npgsql/master/LICENSE.txt
+ PostgreSQL
git
git://github.com/npgsql/EntityFramework6.Npgsql
true
@@ -39,7 +39,7 @@
-
+
diff --git a/src/EntityFramework6.Npgsql/NpgsqlConnectionFactory.cs b/src/EntityFramework6.Npgsql/NpgsqlConnectionFactory.cs
index 926d39c..1d5e499 100644
--- a/src/EntityFramework6.Npgsql/NpgsqlConnectionFactory.cs
+++ b/src/EntityFramework6.Npgsql/NpgsqlConnectionFactory.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System.Data.Common;
+using System.Data.Common;
using System.Data.Entity.Infrastructure;
namespace Npgsql
diff --git a/src/EntityFramework6.Npgsql/NpgsqlMigrationSqlGenerator.cs b/src/EntityFramework6.Npgsql/NpgsqlMigrationSqlGenerator.cs
index cf8f413..c3f26e0 100644
--- a/src/EntityFramework6.Npgsql/NpgsqlMigrationSqlGenerator.cs
+++ b/src/EntityFramework6.Npgsql/NpgsqlMigrationSqlGenerator.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations.Model;
using System.Data.Entity.Migrations.Sql;
@@ -436,7 +413,7 @@ protected virtual void Convert(RenameIndexOperation renameIndexOperation)
string GetSchemaNameFromFullTableName(string tableFullName)
{
var dotIndex = tableFullName.IndexOf('.');
- return dotIndex != -1 ? tableFullName.Remove(dotIndex) : "dto";
+ return dotIndex != -1 ? tableFullName.Remove(dotIndex) : "dto";
//TODO: Check always setting dto schema if no schema in table name is not bug
}
diff --git a/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs b/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs
index a6d4350..a76542a 100644
--- a/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs
+++ b/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Core.Common;
diff --git a/src/EntityFramework6.Npgsql/NpgsqlServices.cs b/src/EntityFramework6.Npgsql/NpgsqlServices.cs
index a7f1abd..0a0351d 100644
--- a/src/EntityFramework6.Npgsql/NpgsqlServices.cs
+++ b/src/EntityFramework6.Npgsql/NpgsqlServices.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Text;
using JetBrains.Annotations;
using System.Data.Entity.Core.Common;
@@ -32,6 +9,7 @@
using Npgsql.SqlGenerators;
using DbConnection = System.Data.Common.DbConnection;
using DbCommand = System.Data.Common.DbCommand;
+using System.Data.Common;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
@@ -73,6 +51,26 @@ internal DbCommand CreateDbCommand(Version serverVersion, DbCommandTree commandT
return command;
}
+ protected override void SetDbParameterValue(DbParameter parameter, TypeUsage parameterType, object value)
+ {
+ base.SetDbParameterValue(parameter, parameterType, value);
+ ConvertValueToNumericIfEnum(parameter);
+ }
+
+ // Npgsql > 4.0 does strict type checks on integral values and fails with enums passed with numeric DbType.
+ static void ConvertValueToNumericIfEnum(DbParameter parameter)
+ {
+ var parameterValueObjectType = parameter.Value.GetType();
+
+ if (!parameterValueObjectType.IsEnum)
+ {
+ return;
+ }
+
+ var underlyingType = Enum.GetUnderlyingType(parameterValueObjectType);
+ parameter.Value = Convert.ChangeType(parameter.Value, underlyingType);
+ }
+
internal void TranslateCommandTree(Version serverVersion, DbCommandTree commandTree, DbCommand command, bool createParametersForNonSelect = true)
{
SqlBaseGenerator sqlGenerator;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/PendingProjectsNode.cs b/src/EntityFramework6.Npgsql/SqlGenerators/PendingProjectsNode.cs
index 646fba6..346a1e6 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/PendingProjectsNode.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/PendingProjectsNode.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Npgsql.SqlGenerators
{
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs b/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs
index c2247fc..b36413a 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/SqlDeleteGenerator.cs b/src/EntityFramework6.Npgsql/SqlGenerators/SqlDeleteGenerator.cs
index 0766ac0..a24eb92 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/SqlDeleteGenerator.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/SqlDeleteGenerator.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Data.Common;
using System.Data.Entity.Core.Common.CommandTrees;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/SqlInsertGenerator.cs b/src/EntityFramework6.Npgsql/SqlGenerators/SqlInsertGenerator.cs
index 0e0fe5a..856a31a 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/SqlInsertGenerator.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/SqlInsertGenerator.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Entity.Core.Common.CommandTrees;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/SqlSelectGenerator.cs b/src/EntityFramework6.Npgsql/SqlGenerators/SqlSelectGenerator.cs
index 22d22e6..ed2616a 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/SqlSelectGenerator.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/SqlSelectGenerator.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Linq;
using System.Data.Common;
using System.Diagnostics;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/SqlUpdateGenerator.cs b/src/EntityFramework6.Npgsql/SqlGenerators/SqlUpdateGenerator.cs
index fde7c7a..acf3fb3 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/SqlUpdateGenerator.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/SqlUpdateGenerator.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Data.Common;
using System.Data.Entity.Core.Common.CommandTrees;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/StringPair.cs b/src/EntityFramework6.Npgsql/SqlGenerators/StringPair.cs
index c605574..72d2512 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/StringPair.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/StringPair.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs b/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs
index 2621c74..b952deb 100644
--- a/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs
+++ b/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/test/EntityFramework6.Npgsql.Tests/App.config b/test/EntityFramework6.Npgsql.Tests/App.config
index 931aca8..3bd6d0b 100644
--- a/test/EntityFramework6.Npgsql.Tests/App.config
+++ b/test/EntityFramework6.Npgsql.Tests/App.config
@@ -29,7 +29,7 @@
-
+
diff --git a/test/EntityFramework6.Npgsql.Tests/EntityFramework6.Npgsql.Tests.csproj b/test/EntityFramework6.Npgsql.Tests/EntityFramework6.Npgsql.Tests.csproj
index de91a6a..12e4322 100644
--- a/test/EntityFramework6.Npgsql.Tests/EntityFramework6.Npgsql.Tests.csproj
+++ b/test/EntityFramework6.Npgsql.Tests/EntityFramework6.Npgsql.Tests.csproj
@@ -7,10 +7,10 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/test/EntityFramework6.Npgsql.Tests/EntityFrameworkBasicTests.cs b/test/EntityFramework6.Npgsql.Tests/EntityFrameworkBasicTests.cs
index cc7d85f..4e89635 100644
--- a/test/EntityFramework6.Npgsql.Tests/EntityFrameworkBasicTests.cs
+++ b/test/EntityFramework6.Npgsql.Tests/EntityFrameworkBasicTests.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using Npgsql;
+using Npgsql;
using NUnit.Framework;
using System;
using System.Collections.Generic;
@@ -847,5 +824,70 @@ public void Test_string_multiple_null_propagation()
query.ToString());
}
}
+
+ [Test]
+ public void Test_enum()
+ {
+ using (var context = new BloggingContext(ConnectionString))
+ {
+ context.Database.Log = Console.Out.WriteLine;
+
+ context.ClrEnumEntities.Add(
+ new ClrEnumEntity
+ {
+ TestByte = TestByteEnum.Bar,
+ TestShort = TestShortEnum.Bar,
+ TestInt = TestIntEnum.Bar,
+ TestLong = TestLongEnum.Bar
+ });
+ context.SaveChanges();
+
+ var query = context.ClrEnumEntities.Where(
+ x => x.TestByte == TestByteEnum.Bar
+ && x.TestShort == TestShortEnum.Bar
+ && x.TestInt == TestIntEnum.Bar
+ && x.TestLong == TestLongEnum.Bar);
+
+ var result = query.First();
+ Assert.That(result.TestByte, Is.EqualTo(TestByteEnum.Bar));
+ Assert.That(result.TestShort, Is.EqualTo(TestShortEnum.Bar));
+ Assert.That(result.TestInt, Is.EqualTo(TestIntEnum.Bar));
+ Assert.That(result.TestLong, Is.EqualTo(TestLongEnum.Bar));
+ }
+ }
+
+ [Test]
+ public void Test_enum_composite_key()
+ {
+ using (var context = new BloggingContext(ConnectionString))
+ {
+ context.Database.Log = Console.Out.WriteLine;
+
+ context.ClrEnumCompositeKeyEntities.Add(
+ new ClrEnumCompositeKeyEntity
+ {
+ TestByte = TestByteEnum.Bar,
+ TestShort = TestShortEnum.Bar,
+ TestInt = TestIntEnum.Bar,
+ TestLong = TestLongEnum.Bar
+ });
+ context.SaveChanges();
+ }
+
+ using (var context = new BloggingContext(ConnectionString))
+ {
+ var result = context.ClrEnumCompositeKeyEntities.Find(
+ TestByteEnum.Bar,
+ TestShortEnum.Bar,
+ TestIntEnum.Bar,
+ TestLongEnum.Bar);
+
+ Assert.That(result, Is.Not.Null);
+ Assert.That(result.TestByte, Is.EqualTo(TestByteEnum.Bar));
+ Assert.That(result.TestShort, Is.EqualTo(TestShortEnum.Bar));
+ Assert.That(result.TestInt, Is.EqualTo(TestIntEnum.Bar));
+ Assert.That(result.TestLong, Is.EqualTo(TestLongEnum.Bar));
+ }
+ }
}
}
diff --git a/test/EntityFramework6.Npgsql.Tests/EntityFrameworkMigrationTests.cs b/test/EntityFramework6.Npgsql.Tests/EntityFrameworkMigrationTests.cs
index dccc6fd..3fde9fb 100644
--- a/test/EntityFramework6.Npgsql.Tests/EntityFrameworkMigrationTests.cs
+++ b/test/EntityFramework6.Npgsql.Tests/EntityFrameworkMigrationTests.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using Npgsql;
+using Npgsql;
using NUnit.Framework;
using System;
using System.Collections.Generic;
@@ -491,7 +468,7 @@ public void RenameIndexOperation()
}
else
{
- Assert.AreEqual("ALTER INDEX someSchema.\"someOldIndexName\" RENAME TO \"someNewIndexName\"", statements.ElementAt(0).Sql);
+ Assert.AreEqual("ALTER INDEX someSchema.\"someOldIndexName\" RENAME TO \"someNewIndexName\"", statements.ElementAt(0).Sql);
}
}
diff --git a/test/EntityFramework6.Npgsql.Tests/FullTextSearchTests.cs b/test/EntityFramework6.Npgsql.Tests/FullTextSearchTests.cs
index 101e8b3..6d81f43 100644
--- a/test/EntityFramework6.Npgsql.Tests/FullTextSearchTests.cs
+++ b/test/EntityFramework6.Npgsql.Tests/FullTextSearchTests.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using Npgsql;
+using Npgsql;
using NUnit.Framework;
using System;
using System.Collections.Generic;
diff --git a/test/EntityFramework6.Npgsql.Tests/NLogLoggingProvider.cs b/test/EntityFramework6.Npgsql.Tests/NLogLoggingProvider.cs
index e8940e9..509a7f3 100644
--- a/test/EntityFramework6.Npgsql.Tests/NLogLoggingProvider.cs
+++ b/test/EntityFramework6.Npgsql.Tests/NLogLoggingProvider.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using NLog;
using Npgsql.Logging;
diff --git a/test/EntityFramework6.Npgsql.Tests/PatternMatchingTests.cs b/test/EntityFramework6.Npgsql.Tests/PatternMatchingTests.cs
index 6260b90..6f83d75 100644
--- a/test/EntityFramework6.Npgsql.Tests/PatternMatchingTests.cs
+++ b/test/EntityFramework6.Npgsql.Tests/PatternMatchingTests.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using Npgsql;
+using Npgsql;
using NUnit.Framework;
using System;
using System.Collections.Generic;
diff --git a/test/EntityFramework6.Npgsql.Tests/Support/EntityFrameworkTestBase.cs b/test/EntityFramework6.Npgsql.Tests/Support/EntityFrameworkTestBase.cs
index d00f6ca..d07af64 100644
--- a/test/EntityFramework6.Npgsql.Tests/Support/EntityFrameworkTestBase.cs
+++ b/test/EntityFramework6.Npgsql.Tests/Support/EntityFrameworkTestBase.cs
@@ -1,30 +1,8 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using Npgsql;
+using Npgsql;
using NUnit.Framework;
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Linq;
@@ -102,6 +80,54 @@ public class Post
public virtual Blog Blog { get; set; }
}
+ public class ClrEnumEntity
+ {
+ public int Id { get; set; }
+ public TestByteEnum TestByte { get; set; }
+ public TestShortEnum TestShort { get; set; }
+ public TestIntEnum TestInt { get; set; }
+ public TestLongEnum TestLong { get; set; }
+ }
+
+ public class ClrEnumCompositeKeyEntity
+ {
+ [Key, Column(Order = 1)]
+ public TestByteEnum TestByte { get; set; }
+
+ [Key, Column(Order = 2)]
+ public TestShortEnum TestShort { get; set; }
+
+ [Key, Column(Order = 3)]
+ public TestIntEnum TestInt { get; set; }
+
+ [Key, Column(Order = 4)]
+ public TestLongEnum TestLong { get; set; }
+ }
+
+ public enum TestByteEnum : byte
+ {
+ Foo = 0,
+ Bar = 1
+ }
+
+ public enum TestShortEnum : short
+ {
+ Foo = 0,
+ Bar = 1
+ }
+
+ public enum TestIntEnum
+ {
+ Foo = 0,
+ Bar = 1
+ }
+
+ public enum TestLongEnum : long
+ {
+ Foo = 0,
+ Bar = 1
+ }
+
public class NoColumnsEntity
{
public int Id { get; set; }
@@ -131,6 +157,8 @@ public BloggingContext(string connection)
public DbSet Blogs { get; set; }
public DbSet Posts { get; set; }
public DbSet NoColumnsEntities { get; set; }
+ public DbSet ClrEnumEntities { get; set; }
+ public DbSet ClrEnumCompositeKeyEntities { get; set; }
public DbSet Users { get; set; }
public DbSet Editors { get; set; }
public DbSet Administrators { get; set; }
@@ -151,7 +179,7 @@ public static int StoredEchoFunction(int value)
public IQueryable GetBlogsByName(string name)
{
ObjectParameter nameParameter = new ObjectParameter("Name", name);
-
+
return ((IObjectContextAdapter)this).ObjectContext.CreateQuery(
$"[GetBlogsByName](@Name)", nameParameter);
}
@@ -164,6 +192,8 @@ private static DbCompiledModel CreateModel(NpgsqlConnection connection)
dbModelBuilder.Entity();
dbModelBuilder.Entity();
dbModelBuilder.Entity();
+ dbModelBuilder.Entity();
+ dbModelBuilder.Entity();
dbModelBuilder.Entity();
dbModelBuilder.Entity();
dbModelBuilder.Entity();
@@ -284,7 +314,7 @@ private static DbCompiledModel CreateModel(NpgsqlConnection connection)
{
IsFunctionImport = true,
IsComposable = true,
- Parameters = new[]
+ Parameters = new[]
{
FunctionParameter.Create("Name", stringPrimitiveType, ParameterMode.In)
},
@@ -292,7 +322,7 @@ private static DbCompiledModel CreateModel(NpgsqlConnection connection)
{
FunctionParameter.Create("ReturnType1", modelBlogConceptualType.GetCollectionType(), ParameterMode.ReturnValue)
},
- EntitySets = new[]
+ EntitySets = new[]
{
dbModel.ConceptualModel.Container.EntitySets.First(x => x.ElementType == modelBlogConceptualType)
}
diff --git a/test/EntityFramework6.Npgsql.Tests/Support/TestBase.cs b/test/EntityFramework6.Npgsql.Tests/Support/TestBase.cs
index d11f508..0ccad6d 100644
--- a/test/EntityFramework6.Npgsql.Tests/Support/TestBase.cs
+++ b/test/EntityFramework6.Npgsql.Tests/Support/TestBase.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using NLog.Config;
using NLog.Targets;
using NLog;
diff --git a/test/EntityFramework6.Npgsql.Tests/Support/TestUtil.cs b/test/EntityFramework6.Npgsql.Tests/Support/TestUtil.cs
index b34eeab..5b46519 100644
--- a/test/EntityFramework6.Npgsql.Tests/Support/TestUtil.cs
+++ b/test/EntityFramework6.Npgsql.Tests/Support/TestUtil.cs
@@ -1,27 +1,4 @@
-#region License
-// The PostgreSQL License
-//
-// Copyright (C) 2016 The Npgsql Development Team
-//
-// Permission to use, copy, modify, and distribute this software and its
-// documentation for any purpose, without fee, and without a written
-// agreement is hereby granted, provided that the above copyright notice
-// and this paragraph and the following two paragraphs appear in all copies.
-//
-// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
-// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
-// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//
-// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
-// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-#endregion
-
-using System;
+using System;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;