From 346e5cc4b190c50dfd999ebf053612fffdfbfcfc Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 6 Dec 2013 18:58:11 +0100 Subject: [PATCH 01/24] Accept operator @@ for full text search queries Example: where search_vector @@ to_tsquery('english', @p0) --- Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs index 0524aeebde..b5958302b9 100644 --- a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs +++ b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs @@ -650,7 +650,7 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int break; case TokenType.Param : - if (IsParamNameChar(ch)) + if (IsParamNameChar(ch) || ch == '@') //Accept operator @@ for FullTextSearch { currTokenLen++; } From f1f414942ab6f64836d7b77b12f3efeb75dab10b Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 6 Dec 2013 19:00:15 +0100 Subject: [PATCH 02/24] Find FieldIndex where column name use _ CreatedAt (field) == created_at (column name) --- Npgsql/Npgsql/NpgsqlRowDescription.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Npgsql/Npgsql/NpgsqlRowDescription.cs b/Npgsql/Npgsql/NpgsqlRowDescription.cs index 533a32cb25..067898d9ac 100644 --- a/Npgsql/Npgsql/NpgsqlRowDescription.cs +++ b/Npgsql/Npgsql/NpgsqlRowDescription.cs @@ -32,6 +32,7 @@ using System.IO; using System.Text; using NpgsqlTypes; +using System.Text.RegularExpressions; namespace Npgsql { @@ -196,13 +197,22 @@ public int TryFieldIndex(string fieldName) public int FieldIndex(String fieldName) { int ret = -1; - if(field_name_index_table.TryGetValue(fieldName, out ret) || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret)) + string fieldNameUnderScore = ConvertToUnderscore(fieldName); + if (field_name_index_table.TryGetValue(fieldName, out ret) + || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret) + || field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) + || caseInsensitiveNameIndexTable.TryGetValue(fieldNameUnderScore, out ret)) return ret; else if(_compatVersion < GET_ORDINAL_THROW_EXCEPTION) return -1; else throw new IndexOutOfRangeException("Field not found"); } + + private string ConvertToUnderscore(string val) + { + return Regex.Replace(val, @"(\p{Ll})(\p{Lu})", "$1_$2"); + } } internal sealed class NpgsqlRowDescriptionV2 : NpgsqlRowDescription From f734a884d943e774265d9a43cd8a49217fac0ed6 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Thu, 12 Dec 2013 18:51:04 +0100 Subject: [PATCH 03/24] Issue #116 - Tests --- Npgsql.EntityFramework/App.config | 20 +++ .../Npgsql.EntityFramework.csproj | 12 +- .../Tests/EntityFrameworkTests.cs | 166 ++++++++++++++++++ Npgsql.EntityFramework/packages.config | 1 + tests/Npgsql.snk | Bin 0 -> 596 bytes tests/NpgsqlTests.csproj | 9 +- 6 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 Npgsql.EntityFramework/App.config create mode 100644 Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs create mode 100644 tests/Npgsql.snk diff --git a/Npgsql.EntityFramework/App.config b/Npgsql.EntityFramework/App.config new file mode 100644 index 0000000000..fd2b8f7c84 --- /dev/null +++ b/Npgsql.EntityFramework/App.config @@ -0,0 +1,20 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index 2b157aaf1c..6326cb49a6 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -82,6 +82,9 @@ ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.SqlServer.dll + + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll + @@ -94,6 +97,7 @@ + @@ -110,12 +114,18 @@ Properties\CommonAssemblyInfo.cs Code + {9d13b739-62b1-4190-b386-7a9547304eb3} Npgsql + + {e9c258d7-0d8e-4e6a-9857-5c6438591755} + NpgsqlTests + + - + \ No newline at end of file diff --git a/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs b/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs new file mode 100644 index 0000000000..7429fe6755 --- /dev/null +++ b/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs @@ -0,0 +1,166 @@ +using Npgsql; +using NpgsqlTests; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Data.Common; +using System.Data.Entity; +using System.Linq; +using System.Text; + +namespace Tests +{ + public class EntityFrameworkTests : TestBase + { + public EntityFrameworkTests(string backendVersion) : base(backendVersion) { } + + protected override void SetUp() + { + base.SetUp(); + // If this is the first (or only) test being run, the connection has already been opened + // in the fixture setup. Save the extra connecting time. + ExecuteNonQuery(@" -- Table: posts + -- DROP TABLE posts; + + CREATE TABLE posts + ( + id serial NOT NULL, + title character varying, + body character varying, + user_name character varying, + search_vector tsvector, + CONSTRAINT posts_pkey PRIMARY KEY (id) + ) + WITH ( + OIDS=FALSE + ); + + -- Index: posts_search_idx + + -- DROP INDEX posts_search_idx; + + CREATE INDEX posts_search_idx + ON posts USING gin (search_vector); + + -- Trigger: posts_vector_update on posts + + -- DROP TRIGGER posts_vector_update ON posts; + + CREATE TRIGGER posts_vector_update + BEFORE INSERT OR UPDATE ON posts + FOR EACH ROW + EXECUTE PROCEDURE tsvector_update_trigger('search_vector', 'pg_catalog.english', 'title', 'body'); + "); + + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('Postgres is awesome', '', 'Clark Kent')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('How postgres is differente from MySQL', '', 'Lois Lane')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('Tips for Mysql', '', 'Bruce Wayne')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('SECRET', 'Postgres for the win', 'Dick Grayson')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('Oracle acquires some other database', 'Mysql but no postgres' , 'Oliver Queen')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('No Database', 'Nothing to see here', 'Kyle Ryner')"); + } + + protected override void TearDown() + { + ExecuteNonQuery("DROP TABLE posts"); + base.TearDown(); + } + + [Test] + public void FullTextSearchSimpleTest() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new DbContext(conn, true)) + { + var query = @"select * + from posts + where search_vector @@ to_tsquery('english', @p0) + order by ts_rank_cd(search_vector, to_tsquery('english', @p0)) desc"; + var p = "postgres"; + var posts = ctx.Database.SqlQuery(query, p).ToList(); + + Assert.AreEqual(4, posts.Count); + } + } + + [Test] + public void FullTextSearchAndTest() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new DbContext(conn, true)) + { + var query = @"select * + from posts + where search_vector @@ to_tsquery('english', @p0) + order by ts_rank_cd(search_vector, to_tsquery('english', @p0)) desc"; + var p = "postgres & mysql"; + var posts = ctx.Database.SqlQuery(query, p).ToList(); + + Assert.AreEqual(2, posts.Count); + } + } + + [Test] + public void FullTextSearchOrTest() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new DbContext(conn, true)) + { + var query = @"select * + from posts + where search_vector @@ to_tsquery('english', @p0) + order by ts_rank_cd(search_vector, to_tsquery('english', @p0)) desc"; + var p = "postgres | mysql"; + var posts = ctx.Database.SqlQuery(query, p).ToList(); + + Assert.AreEqual(5, posts.Count); + } + } + + [Test] + public void EntityFrameworkSqlQueryMapWithUnderscoreColumnNames() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new TestDbContext(conn, true)) + { + var query = @"select * from posts"; + var posts = ctx.Database.SqlQuery(query).ToList(); + + Assert.AreEqual(6, posts.Count); + Assert.AreEqual("Clark Kent", posts.FirstOrDefault().UserName); + } + } + } + + public class TestDbContext : DbContext + { + public TestDbContext(DbConnection existingConnection, bool contextOwnsConnection) + : base(existingConnection, contextOwnsConnection) + { + } + + public DbSet Posts { get; set; } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.Entity().ToTable("posts", "public"); + modelBuilder.Entity().Property(c => c.Id).HasColumnName("id").IsOptional(); + modelBuilder.Entity().Property(c => c.Title).HasColumnName("title").IsOptional(); + modelBuilder.Entity().Property(c => c.Body).HasColumnName("body").IsOptional(); + modelBuilder.Entity().Property(c => c.UserName).HasColumnName("user_name").IsOptional(); + } + } + + public class Post + { + public int Id { get; set; } + public string Title { get; set; } + public string Body { get; set; } + public string UserName { get; set; } + } +} diff --git a/Npgsql.EntityFramework/packages.config b/Npgsql.EntityFramework/packages.config index 4fef52d215..fbdacc1a3b 100755 --- a/Npgsql.EntityFramework/packages.config +++ b/Npgsql.EntityFramework/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/tests/Npgsql.snk b/tests/Npgsql.snk new file mode 100644 index 0000000000000000000000000000000000000000..c54133da35e728475916ab2cb3d3a779f4534e75 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096iJXs4WPCYb!Xn5QY^wJ)%R;2_WB@AX4 z1Vb=z9W}{-c%|Q$rY(cXqT4M8B_pW(NfVeQOlyfUn~WXK^g14TpMH4^aTHc0 zf^T5g$mbl;CACzb7kk+?r+}6z@TafGcnx#tc+(5fz14awN}6Z5680)C6Jw-sjLQpV=(U0GFeE$Ff_yLJ$_NKK?IDb zW0({)$Zx46UC){!`Uav0fK)?<*^FZSUYc=-zN;Xv+0|4&6KM4e@G961d3|${VUA}YKFWQdZ8Utr%kmIW_ z$hKf-N&wOE2QJ8AK(3F4@zDOsnlo+Czp;#)9>DEUH!5w6JX5zU9}OMS3Dl~}l#0CR zn!QmahKG5f(pLI4hr*g5DO}Jl_+T$`DlQ-HtKZWhPgKA=Dl+A~pt_A-ugswv_UP1% iu|{4YuikGZvp4 v4.5 + + true + + + Npgsql.snk + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -172,6 +178,7 @@ + Always @@ -217,4 +224,4 @@ - + \ No newline at end of file From 8be9316b839b403a2bb9ce49ce957d6a681a62b3 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 13:26:09 +0100 Subject: [PATCH 04/24] #116 Tests in NpgsqlTests Project --- .../Npgsql.EntityFramework.csproj | 8 -------- Npgsql.EntityFramework/packages.config | 1 - tests/App.config | 20 +++++++++++++++++++ .../Tests => tests}/EntityFrameworkTests.cs | 4 ++-- tests/NpgsqlTests.csproj | 13 +++++++++++- tests/packages.config | 1 + 6 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 tests/App.config rename {Npgsql.EntityFramework/Tests => tests}/EntityFrameworkTests.cs (98%) diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index 6326cb49a6..b3052add91 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -82,9 +82,6 @@ ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.SqlServer.dll - - ..\packages\NUnit.2.6.2\lib\nunit.framework.dll - @@ -114,17 +111,12 @@ Properties\CommonAssemblyInfo.cs Code - {9d13b739-62b1-4190-b386-7a9547304eb3} Npgsql - - {e9c258d7-0d8e-4e6a-9857-5c6438591755} - NpgsqlTests - diff --git a/Npgsql.EntityFramework/packages.config b/Npgsql.EntityFramework/packages.config index fbdacc1a3b..4fef52d215 100755 --- a/Npgsql.EntityFramework/packages.config +++ b/Npgsql.EntityFramework/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/tests/App.config b/tests/App.config new file mode 100644 index 0000000000..0ffd9db691 --- /dev/null +++ b/tests/App.config @@ -0,0 +1,20 @@ + + + + +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs b/tests/EntityFrameworkTests.cs similarity index 98% rename from Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs rename to tests/EntityFrameworkTests.cs index 7429fe6755..1da02a143a 100644 --- a/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs +++ b/tests/EntityFrameworkTests.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; -namespace Tests +namespace NpgsqlTests { public class EntityFrameworkTests : TestBase { @@ -121,7 +121,7 @@ where search_vector @@ to_tsquery('english', @p0) } [Test] - public void EntityFrameworkSqlQueryMapWithUnderscoreColumnNames() + public void DbContextSqlQueryMapWithUnderscoreColumnNames() { var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); conn.ConnectionString = ConnectionString; diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index 3030b1922d..0838d4bf82 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -132,12 +132,21 @@ v4.5 - true + false Npgsql.snk + + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll + + + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.SqlServer.dll + + + ..\..\..\manray\src\cs\CallForEntriesReader\packages\Npgsql.EntityFramework.dll + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -173,11 +182,13 @@ + + diff --git a/tests/packages.config b/tests/packages.config index 5c3ca54dd7..fbdacc1a3b 100644 --- a/tests/packages.config +++ b/tests/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file From b41e7349037c5fd5e65ff1a18d228f1e6c7e8f40 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 13:54:25 +0100 Subject: [PATCH 05/24] #116 fixing references Removing EntityFramework.SqlServer from NpgsTests --- tests/App.config | 3 --- tests/NpgsqlTests.csproj | 10 ++++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/App.config b/tests/App.config index 0ffd9db691..5f930c914c 100644 --- a/tests/App.config +++ b/tests/App.config @@ -3,14 +3,11 @@
- - - diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index 0838d4bf82..321c15be6d 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -141,12 +141,6 @@ ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll - - ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.SqlServer.dll - - - ..\..\..\manray\src\cs\CallForEntriesReader\packages\Npgsql.EntityFramework.dll - ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -229,6 +223,10 @@ + + {3ec85cba-5b79-11e3-8104-0022198ab089} + Npgsql.EntityFramework + {9D13B739-62B1-4190-B386-7A9547304EB3} Npgsql2012 From 3bdb8c1c5bd0e42cd1361eb3e3682cc30a27c816 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 19:02:22 +0100 Subject: [PATCH 06/24] #116 Removing App.config Removing App.config from Npgsql.EntityFramework --- Npgsql.EntityFramework/App.config | 20 ------------------- .../Npgsql.EntityFramework.csproj | 1 - 2 files changed, 21 deletions(-) delete mode 100644 Npgsql.EntityFramework/App.config diff --git a/Npgsql.EntityFramework/App.config b/Npgsql.EntityFramework/App.config deleted file mode 100644 index fd2b8f7c84..0000000000 --- a/Npgsql.EntityFramework/App.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - -
- - - - - - - - - - - - \ No newline at end of file diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index b3052add91..4332aae73f 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -94,7 +94,6 @@ - From 8b6638a312c59157eeb6216dc0cafdddcc9af511 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 19:47:22 +0100 Subject: [PATCH 07/24] #116 removing the key file from the tests folder --- tests/Npgsql.snk | Bin 596 -> 0 bytes tests/NpgsqlTests.csproj | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 tests/Npgsql.snk diff --git a/tests/Npgsql.snk b/tests/Npgsql.snk deleted file mode 100644 index c54133da35e728475916ab2cb3d3a779f4534e75..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096iJXs4WPCYb!Xn5QY^wJ)%R;2_WB@AX4 z1Vb=z9W}{-c%|Q$rY(cXqT4M8B_pW(NfVeQOlyfUn~WXK^g14TpMH4^aTHc0 zf^T5g$mbl;CACzb7kk+?r+}6z@TafGcnx#tc+(5fz14awN}6Z5680)C6Jw-sjLQpV=(U0GFeE$Ff_yLJ$_NKK?IDb zW0({)$Zx46UC){!`Uav0fK)?<*^FZSUYc=-zN;Xv+0|4&6KM4e@G961d3|${VUA}YKFWQdZ8Utr%kmIW_ z$hKf-N&wOE2QJ8AK(3F4@zDOsnlo+Czp;#)9>DEUH!5w6JX5zU9}OMS3Dl~}l#0CR zn!QmahKG5f(pLI4hr*g5DO}Jl_+T$`DlQ-HtKZWhPgKA=Dl+A~pt_A-ugswv_UP1% iu|{4YuikGZvpfalse - Npgsql.snk + + @@ -183,7 +184,6 @@ - Always From 6d41b3260217c585f26dbeb23db3960daf17698a Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 21:42:21 +0100 Subject: [PATCH 08/24] #116 Add to app.config --- tests/App.config | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/App.config b/tests/App.config index 5f930c914c..77cb73eb24 100644 --- a/tests/App.config +++ b/tests/App.config @@ -11,6 +11,7 @@ + From 2b8325aa6ef11be50877b43e996d4baff34c3c58 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Mon, 16 Dec 2013 11:02:59 +0100 Subject: [PATCH 09/24] #116 ConvertToUnderscoreCase if the first comparison fails --- Npgsql/Npgsql/NpgsqlRowDescription.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Npgsql/Npgsql/NpgsqlRowDescription.cs b/Npgsql/Npgsql/NpgsqlRowDescription.cs index 067898d9ac..e213e2de8c 100644 --- a/Npgsql/Npgsql/NpgsqlRowDescription.cs +++ b/Npgsql/Npgsql/NpgsqlRowDescription.cs @@ -197,16 +197,21 @@ public int TryFieldIndex(string fieldName) public int FieldIndex(String fieldName) { int ret = -1; - string fieldNameUnderScore = ConvertToUnderscore(fieldName); + if (field_name_index_table.TryGetValue(fieldName, out ret) - || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret) - || field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) + || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret)) + return ret; + + string fieldNameUnderScore = ConvertToUnderscore(fieldName); + if(field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) || caseInsensitiveNameIndexTable.TryGetValue(fieldNameUnderScore, out ret)) return ret; - else if(_compatVersion < GET_ORDINAL_THROW_EXCEPTION) + + else if (_compatVersion < GET_ORDINAL_THROW_EXCEPTION) return -1; else throw new IndexOutOfRangeException("Field not found"); + } private string ConvertToUnderscore(string val) From af0548a13ba13d2194f1857d73ebcaf258087d5b Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 20 Dec 2013 22:40:04 +0100 Subject: [PATCH 10/24] Windows integrated security #if directive for mono --- .../Npgsql.EntityFramework.csproj | 80 +++++++++++++++++ .../Npgsql.EntityFrameworkLegacy.csproj | 86 ++++++++++++++++++- Npgsql/Npgsql.csproj | 86 ++++++++++++++++++- .../Npgsql/NpgsqlConnectionStringBuilder.cs | 19 ++-- Npgsql2013.sln | 70 ++++++++++++++- tests/NpgsqlTests.csproj | 60 +++++++++++++ 6 files changed, 386 insertions(+), 15 deletions(-) diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index 4332aae73f..b81fd6ca9b 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -75,6 +75,86 @@ bin\Release-net40\Npgsql.EntityFramework.xml v4.0 + + bin\Mono-Release-net45\ + TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Release-net45\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Debug-net45\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Debug-net45\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 + bin\Debug-net40\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Debug-net45\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Release-net45\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Release-net45\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 + bin\Release-net40\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll diff --git a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj index 5f781f3a67..120ff72b54 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj @@ -96,6 +96,86 @@ bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml v3.5 + + bin\Mono-Release-net45\ + TRACE;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35 + bin\Legacy-Debug-net35\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40 + bin\Legacy-Debug-net40\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + TRACE;WINDOWS;UNMANAGED;NET35 + bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40 + bin\Legacy-Release-net40\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + @@ -127,9 +207,7 @@ Code - - - + {9d13b739-62b1-4190-b386-7a9547304eb3} @@ -137,4 +215,4 @@ - + \ No newline at end of file diff --git a/Npgsql/Npgsql.csproj b/Npgsql/Npgsql.csproj index 67f46d72cb..4eacf33208 100644 --- a/Npgsql/Npgsql.csproj +++ b/Npgsql/Npgsql.csproj @@ -121,6 +121,86 @@ bin\Release-net20\Npgsql.xml v2.0 + + bin\Mono-Release-net45\ + TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES + bin\Release-net45\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + TRACE;DEBUG;WINDOWS;UNMANAGED + bin\Debug-net20\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;ENTITIES + bin\Debug-net35\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES + bin\Debug-net40\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES + bin\Debug-net45\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + TRACE;WINDOWS;UNMANAGED + bin\Release-net20\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + TRACE;WINDOWS;UNMANAGED;NET35;ENTITIES + bin\Release-net35\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES + bin\Release-net40\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + @@ -129,12 +209,12 @@ - + ..\lib\Mono.Security\4.0\Mono.Security.dll - + ..\lib\Mono.Security\2.0\Mono.Security.dll @@ -611,4 +691,4 @@ --> - + \ No newline at end of file diff --git a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs index 904928ecdf..407c55c26c 100644 --- a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs +++ b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs @@ -375,18 +375,25 @@ public string UserName { get { - if ((_integrated_security) && (String.IsNullOrEmpty(_username))) - { - System.Security.Principal.WindowsIdentity identity = - System.Security.Principal.WindowsIdentity.GetCurrent(); - _username = identity.Name.Split('\\')[1]; - } +#if WINDOWS + SetUsernameWindowsIntegratedSecurity(); +#endif return _username; } set { SetValue(GetKeyName(Keywords.UserName), Keywords.UserName, value); } } + private void SetUsernameWindowsIntegratedSecurity() + { + if ((_integrated_security) && (String.IsNullOrEmpty(_username))) + { + System.Security.Principal.WindowsIdentity identity = + System.Security.Principal.WindowsIdentity.GetCurrent(); + _username = identity.Name.Split('\\')[1]; + } + } + private PasswordBytes _password; /// /// Gets or sets the login password as a UTF8 encoded byte array. diff --git a/Npgsql2013.sln b/Npgsql2013.sln index 56b1de83ca..bde78eedca 100644 --- a/Npgsql2013.sln +++ b/Npgsql2013.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 +# Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Npgsql", "Npgsql\Npgsql.csproj", "{9D13B739-62B1-4190-B386-7A9547304EB3}" @@ -13,8 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlTests", "tests\Npgsql EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4A5A60DD-41B6-40BF-B677-227A921ECCC8}" ProjectSection(SolutionItems) = preProject - Npgsql.snk = Npgsql.snk CommonAssemblyInfo.cs = CommonAssemblyInfo.cs + Npgsql.snk = Npgsql.snk EndProjectSection EndProject Global @@ -23,6 +23,14 @@ Global Debug-net35|AnyCPU = Debug-net35|AnyCPU Debug-net40|AnyCPU = Debug-net40|AnyCPU Debug-net45|AnyCPU = Debug-net45|AnyCPU + Mono-Debug-net20|AnyCPU = Mono-Debug-net20|AnyCPU + Mono-Debug-net35|AnyCPU = Mono-Debug-net35|AnyCPU + Mono-Debug-net40|AnyCPU = Mono-Debug-net40|AnyCPU + Mono-Debug-net45|AnyCPU = Mono-Debug-net45|AnyCPU + Mono-Release-net20|AnyCPU = Mono-Release-net20|AnyCPU + Mono-Release-net35|AnyCPU = Mono-Release-net35|AnyCPU + Mono-Release-net40|AnyCPU = Mono-Release-net40|AnyCPU + Mono-Release-net45|AnyCPU = Mono-Release-net45|AnyCPU Release-net20|AnyCPU = Release-net20|AnyCPU Release-net35|AnyCPU = Release-net35|AnyCPU Release-net40|AnyCPU = Release-net40|AnyCPU @@ -37,6 +45,22 @@ Global {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU @@ -51,6 +75,18 @@ Global {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net40|AnyCPU.ActiveCfg = Release-net40|Any CPU @@ -64,6 +100,20 @@ Global {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.Build.0 = Release-net35|Any CPU @@ -79,6 +129,22 @@ Global {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index 37b50fc716..a5db98c39a 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -138,6 +138,66 @@ + + bin\Mono-Release-net45\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll From 025201f469a6db904277f275bbd54e0de03785f6 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Sat, 21 Dec 2013 16:16:12 +0100 Subject: [PATCH 11/24] Revert "Windows integrated security #if directive for mono" This reverts commit af0548a13ba13d2194f1857d73ebcaf258087d5b. --- .../Npgsql.EntityFramework.csproj | 80 ----------------- .../Npgsql.EntityFrameworkLegacy.csproj | 86 +------------------ Npgsql/Npgsql.csproj | 86 +------------------ .../Npgsql/NpgsqlConnectionStringBuilder.cs | 19 ++-- Npgsql2013.sln | 70 +-------------- tests/NpgsqlTests.csproj | 60 ------------- 6 files changed, 15 insertions(+), 386 deletions(-) diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index b81fd6ca9b..4332aae73f 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -75,86 +75,6 @@ bin\Release-net40\Npgsql.EntityFramework.xml v4.0 - - bin\Mono-Release-net45\ - TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Release-net45\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Debug-net45\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Debug-net45\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 - bin\Debug-net40\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Debug-net45\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Release-net45\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Release-net45\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 - bin\Release-net40\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll diff --git a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj index 120ff72b54..5f781f3a67 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj @@ -96,86 +96,6 @@ bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml v3.5 - - bin\Mono-Release-net45\ - TRACE;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35 - bin\Legacy-Debug-net35\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40 - bin\Legacy-Debug-net40\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - TRACE;WINDOWS;UNMANAGED;NET35 - bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40 - bin\Legacy-Release-net40\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - @@ -207,7 +127,9 @@ Code - + + + {9d13b739-62b1-4190-b386-7a9547304eb3} @@ -215,4 +137,4 @@ - \ No newline at end of file + diff --git a/Npgsql/Npgsql.csproj b/Npgsql/Npgsql.csproj index 4eacf33208..67f46d72cb 100644 --- a/Npgsql/Npgsql.csproj +++ b/Npgsql/Npgsql.csproj @@ -121,86 +121,6 @@ bin\Release-net20\Npgsql.xml v2.0 - - bin\Mono-Release-net45\ - TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES - bin\Release-net45\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - TRACE;DEBUG;WINDOWS;UNMANAGED - bin\Debug-net20\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;ENTITIES - bin\Debug-net35\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES - bin\Debug-net40\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES - bin\Debug-net45\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - TRACE;WINDOWS;UNMANAGED - bin\Release-net20\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - TRACE;WINDOWS;UNMANAGED;NET35;ENTITIES - bin\Release-net35\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES - bin\Release-net40\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - @@ -209,12 +129,12 @@ - + ..\lib\Mono.Security\4.0\Mono.Security.dll - + ..\lib\Mono.Security\2.0\Mono.Security.dll @@ -691,4 +611,4 @@ --> - \ No newline at end of file + diff --git a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs index 407c55c26c..904928ecdf 100644 --- a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs +++ b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs @@ -375,25 +375,18 @@ public string UserName { get { -#if WINDOWS - SetUsernameWindowsIntegratedSecurity(); -#endif + if ((_integrated_security) && (String.IsNullOrEmpty(_username))) + { + System.Security.Principal.WindowsIdentity identity = + System.Security.Principal.WindowsIdentity.GetCurrent(); + _username = identity.Name.Split('\\')[1]; + } return _username; } set { SetValue(GetKeyName(Keywords.UserName), Keywords.UserName, value); } } - private void SetUsernameWindowsIntegratedSecurity() - { - if ((_integrated_security) && (String.IsNullOrEmpty(_username))) - { - System.Security.Principal.WindowsIdentity identity = - System.Security.Principal.WindowsIdentity.GetCurrent(); - _username = identity.Name.Split('\\')[1]; - } - } - private PasswordBytes _password; /// /// Gets or sets the login password as a UTF8 encoded byte array. diff --git a/Npgsql2013.sln b/Npgsql2013.sln index bde78eedca..56b1de83ca 100644 --- a/Npgsql2013.sln +++ b/Npgsql2013.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop +# Visual Studio 2013 VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Npgsql", "Npgsql\Npgsql.csproj", "{9D13B739-62B1-4190-B386-7A9547304EB3}" @@ -13,8 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlTests", "tests\Npgsql EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4A5A60DD-41B6-40BF-B677-227A921ECCC8}" ProjectSection(SolutionItems) = preProject - CommonAssemblyInfo.cs = CommonAssemblyInfo.cs Npgsql.snk = Npgsql.snk + CommonAssemblyInfo.cs = CommonAssemblyInfo.cs EndProjectSection EndProject Global @@ -23,14 +23,6 @@ Global Debug-net35|AnyCPU = Debug-net35|AnyCPU Debug-net40|AnyCPU = Debug-net40|AnyCPU Debug-net45|AnyCPU = Debug-net45|AnyCPU - Mono-Debug-net20|AnyCPU = Mono-Debug-net20|AnyCPU - Mono-Debug-net35|AnyCPU = Mono-Debug-net35|AnyCPU - Mono-Debug-net40|AnyCPU = Mono-Debug-net40|AnyCPU - Mono-Debug-net45|AnyCPU = Mono-Debug-net45|AnyCPU - Mono-Release-net20|AnyCPU = Mono-Release-net20|AnyCPU - Mono-Release-net35|AnyCPU = Mono-Release-net35|AnyCPU - Mono-Release-net40|AnyCPU = Mono-Release-net40|AnyCPU - Mono-Release-net45|AnyCPU = Mono-Release-net45|AnyCPU Release-net20|AnyCPU = Release-net20|AnyCPU Release-net35|AnyCPU = Release-net35|AnyCPU Release-net40|AnyCPU = Release-net40|AnyCPU @@ -45,22 +37,6 @@ Global {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU @@ -75,18 +51,6 @@ Global {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net40|AnyCPU.ActiveCfg = Release-net40|Any CPU @@ -100,20 +64,6 @@ Global {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.Build.0 = Release-net35|Any CPU @@ -129,22 +79,6 @@ Global {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index a5db98c39a..37b50fc716 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -138,66 +138,6 @@ - - bin\Mono-Release-net45\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll From 19876b22d0d83e4f6ffe26646b68608ce542ab0d Mon Sep 17 00:00:00 2001 From: Glen Parker Date: Sat, 21 Dec 2013 15:18:54 -0800 Subject: [PATCH 12/24] NpgsqlCommand.AppendCommandReplacingParameterValues() and operators @@, @> and <@. Fix bug that would turn operators @@, @> and <@ in ::, :>, and <: respectively. Add tests for said operator butchery. --- Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs | 81 +++++++++++++++----------- tests/CommandTests.cs | 27 +++++++++ 2 files changed, 73 insertions(+), 35 deletions(-) diff --git a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs index 0524aeebde..647e8bc363 100644 --- a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs +++ b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs @@ -558,7 +558,8 @@ private enum TokenType None, Quoted, Param, - Colon + Colon, + FullTextMatchOp } /// @@ -579,6 +580,7 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int int currTokenBeg = begin; int currTokenLen = 0; Dictionary paramOrdinalMap = null; + int end = begin + length; if (prepare) { @@ -590,7 +592,7 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int } } - for (int currCharOfs = begin ; currCharOfs < begin + length ; currCharOfs++) + for (int currCharOfs = begin ; currCharOfs < end ; currCharOfs++) { char ch = src[currCharOfs]; @@ -602,7 +604,7 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int case TokenType.None : switch (ch) { - case '\'': + case '\'' : if (currTokenLen > 0) { dest.WriteString(src.Substring(currTokenBeg, currTokenLen)); @@ -615,7 +617,8 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int break; - case ':': + case ':' : + if (currTokenLen > 0) { dest.WriteString(src.Substring(currTokenBeg, currTokenLen)); } @@ -627,20 +630,21 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int break; - case '@': + case '<' : + case '@' : + if (currTokenLen > 0) { dest.WriteString(src.Substring(currTokenBeg, currTokenLen)); } - currTokenType = TokenType.Param; + currTokenType = TokenType.FullTextMatchOp; - currTokenBeg = currCharOfs + 1; - currTokenLen = 0; - paramMarker = '@'; + currTokenBeg = currCharOfs; + currTokenLen = 1; break; - default: + default : currTokenLen++; break; @@ -705,12 +709,12 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int case TokenType.Quoted : switch (ch) { - case '\'': + case '\'' : currTokenLen++; break; - default: + default : if (currTokenLen > 1 && lastChar == '\'') { dest.WriteString(src.Substring(currTokenBeg, currTokenLen)); @@ -734,40 +738,47 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int break; case TokenType.Colon : - switch (ch) + if (IsParamNameChar(ch)) { - case ':': - currTokenLen++; - - break; + currTokenType = TokenType.Param; - default: - if (currTokenLen == 1) - { - currTokenType = TokenType.Param; + currTokenBeg = currCharOfs; + currTokenLen = 0; + paramMarker = ':'; - currTokenBeg = currCharOfs; - currTokenLen = 0; - paramMarker = ':'; - } - else - { - dest.WriteString(src.Substring(currTokenBeg, currTokenLen)); + // Re-evaluate this character + goto ProcessCharacter; + } + else + { + // Demote to the unknown token type and continue. + currTokenType = TokenType.None; + currTokenLen++; + } - currTokenType = TokenType.None; + break; - currTokenBeg = currCharOfs; - currTokenLen = 0; - } + case TokenType.FullTextMatchOp : + if (lastChar == '@' && IsParamNameChar(ch)) + { + currTokenType = TokenType.Param; - // Re-evaluate this character - goto ProcessCharacter; + currTokenBeg = currCharOfs; + currTokenLen = 0; + paramMarker = '@'; + // Re-evaluate this character + goto ProcessCharacter; + } + else + { + // Demote to the unknown token type and continue. + currTokenType = TokenType.None; + currTokenLen++; } break; - } lastChar = ch; diff --git a/tests/CommandTests.cs b/tests/CommandTests.cs index 7b66d35227..3ddc35fea8 100644 --- a/tests/CommandTests.cs +++ b/tests/CommandTests.cs @@ -3481,5 +3481,32 @@ public void DataTypeTests() Assert.AreEqual(typeof(NpgsqlTimeTZ), result.GetType()); */ } + + [Test] + // Target NpgsqlCommand.AppendCommandReplacingParameterValues()'s handling of operator @@. + public void Operator_At_At_RewriteTest() + { + NpgsqlCommand cmd = new NpgsqlCommand("SELECT to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat')", Conn); + + Assert.IsTrue((bool)cmd.ExecuteScalar()); + } + + [Test] + // Target NpgsqlCommand.AppendCommandReplacingParameterValues()'s handling of operator @>. + public void Operator_At_GT_RewriteTest() + { + NpgsqlCommand cmd = new NpgsqlCommand("SELECT 'cat'::tsquery @> 'cat & rat'::tsquery", Conn); + + Assert.IsFalse((bool)cmd.ExecuteScalar()); + } + + [Test] + // Target NpgsqlCommand.AppendCommandReplacingParameterValues()'s handling of operator <@. + public void Operator_LT_At_RewriteTest() + { + NpgsqlCommand cmd = new NpgsqlCommand("SELECT 'cat'::tsquery <@ 'cat & rat'::tsquery", Conn); + + Assert.IsTrue((bool)cmd.ExecuteScalar()); + } } } From 33cae49a4df9522d6a74826269b3392b56d28b3c Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 6 Dec 2013 18:58:11 +0100 Subject: [PATCH 13/24] Accept operator @@ for full text search queries Example: where search_vector @@ to_tsquery('english', @p0) --- Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs index 647e8bc363..735beab304 100644 --- a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs +++ b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs @@ -654,7 +654,7 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int break; case TokenType.Param : - if (IsParamNameChar(ch)) + if (IsParamNameChar(ch) || ch == '@') //Accept operator @@ for FullTextSearch { currTokenLen++; } From 478c00db134b459d14add8d8a682d72d01b267fe Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 6 Dec 2013 19:00:15 +0100 Subject: [PATCH 14/24] Find FieldIndex where column name use _ CreatedAt (field) == created_at (column name) --- Npgsql/Npgsql/NpgsqlRowDescription.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Npgsql/Npgsql/NpgsqlRowDescription.cs b/Npgsql/Npgsql/NpgsqlRowDescription.cs index 533a32cb25..067898d9ac 100644 --- a/Npgsql/Npgsql/NpgsqlRowDescription.cs +++ b/Npgsql/Npgsql/NpgsqlRowDescription.cs @@ -32,6 +32,7 @@ using System.IO; using System.Text; using NpgsqlTypes; +using System.Text.RegularExpressions; namespace Npgsql { @@ -196,13 +197,22 @@ public int TryFieldIndex(string fieldName) public int FieldIndex(String fieldName) { int ret = -1; - if(field_name_index_table.TryGetValue(fieldName, out ret) || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret)) + string fieldNameUnderScore = ConvertToUnderscore(fieldName); + if (field_name_index_table.TryGetValue(fieldName, out ret) + || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret) + || field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) + || caseInsensitiveNameIndexTable.TryGetValue(fieldNameUnderScore, out ret)) return ret; else if(_compatVersion < GET_ORDINAL_THROW_EXCEPTION) return -1; else throw new IndexOutOfRangeException("Field not found"); } + + private string ConvertToUnderscore(string val) + { + return Regex.Replace(val, @"(\p{Ll})(\p{Lu})", "$1_$2"); + } } internal sealed class NpgsqlRowDescriptionV2 : NpgsqlRowDescription From 6f52b653e9d2139f8a2f00ac08f98795bfb7ad51 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Thu, 12 Dec 2013 18:51:04 +0100 Subject: [PATCH 15/24] Issue #116 - Tests --- Npgsql.EntityFramework/App.config | 20 +++ .../Tests/EntityFrameworkTests.cs | 166 ++++++++++++++++++ Npgsql.EntityFramework/packages.config | 1 + tests/Npgsql.snk | Bin 0 -> 596 bytes tests/NpgsqlTests.csproj | 7 + 5 files changed, 194 insertions(+) create mode 100644 Npgsql.EntityFramework/App.config create mode 100644 Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs create mode 100644 tests/Npgsql.snk diff --git a/Npgsql.EntityFramework/App.config b/Npgsql.EntityFramework/App.config new file mode 100644 index 0000000000..fd2b8f7c84 --- /dev/null +++ b/Npgsql.EntityFramework/App.config @@ -0,0 +1,20 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs b/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs new file mode 100644 index 0000000000..7429fe6755 --- /dev/null +++ b/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs @@ -0,0 +1,166 @@ +using Npgsql; +using NpgsqlTests; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Data.Common; +using System.Data.Entity; +using System.Linq; +using System.Text; + +namespace Tests +{ + public class EntityFrameworkTests : TestBase + { + public EntityFrameworkTests(string backendVersion) : base(backendVersion) { } + + protected override void SetUp() + { + base.SetUp(); + // If this is the first (or only) test being run, the connection has already been opened + // in the fixture setup. Save the extra connecting time. + ExecuteNonQuery(@" -- Table: posts + -- DROP TABLE posts; + + CREATE TABLE posts + ( + id serial NOT NULL, + title character varying, + body character varying, + user_name character varying, + search_vector tsvector, + CONSTRAINT posts_pkey PRIMARY KEY (id) + ) + WITH ( + OIDS=FALSE + ); + + -- Index: posts_search_idx + + -- DROP INDEX posts_search_idx; + + CREATE INDEX posts_search_idx + ON posts USING gin (search_vector); + + -- Trigger: posts_vector_update on posts + + -- DROP TRIGGER posts_vector_update ON posts; + + CREATE TRIGGER posts_vector_update + BEFORE INSERT OR UPDATE ON posts + FOR EACH ROW + EXECUTE PROCEDURE tsvector_update_trigger('search_vector', 'pg_catalog.english', 'title', 'body'); + "); + + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('Postgres is awesome', '', 'Clark Kent')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('How postgres is differente from MySQL', '', 'Lois Lane')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('Tips for Mysql', '', 'Bruce Wayne')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('SECRET', 'Postgres for the win', 'Dick Grayson')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('Oracle acquires some other database', 'Mysql but no postgres' , 'Oliver Queen')"); + ExecuteNonQuery("INSERT INTO posts (title, body, user_name) VALUES ('No Database', 'Nothing to see here', 'Kyle Ryner')"); + } + + protected override void TearDown() + { + ExecuteNonQuery("DROP TABLE posts"); + base.TearDown(); + } + + [Test] + public void FullTextSearchSimpleTest() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new DbContext(conn, true)) + { + var query = @"select * + from posts + where search_vector @@ to_tsquery('english', @p0) + order by ts_rank_cd(search_vector, to_tsquery('english', @p0)) desc"; + var p = "postgres"; + var posts = ctx.Database.SqlQuery(query, p).ToList(); + + Assert.AreEqual(4, posts.Count); + } + } + + [Test] + public void FullTextSearchAndTest() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new DbContext(conn, true)) + { + var query = @"select * + from posts + where search_vector @@ to_tsquery('english', @p0) + order by ts_rank_cd(search_vector, to_tsquery('english', @p0)) desc"; + var p = "postgres & mysql"; + var posts = ctx.Database.SqlQuery(query, p).ToList(); + + Assert.AreEqual(2, posts.Count); + } + } + + [Test] + public void FullTextSearchOrTest() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new DbContext(conn, true)) + { + var query = @"select * + from posts + where search_vector @@ to_tsquery('english', @p0) + order by ts_rank_cd(search_vector, to_tsquery('english', @p0)) desc"; + var p = "postgres | mysql"; + var posts = ctx.Database.SqlQuery(query, p).ToList(); + + Assert.AreEqual(5, posts.Count); + } + } + + [Test] + public void EntityFrameworkSqlQueryMapWithUnderscoreColumnNames() + { + var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); + conn.ConnectionString = ConnectionString; + using (var ctx = new TestDbContext(conn, true)) + { + var query = @"select * from posts"; + var posts = ctx.Database.SqlQuery(query).ToList(); + + Assert.AreEqual(6, posts.Count); + Assert.AreEqual("Clark Kent", posts.FirstOrDefault().UserName); + } + } + } + + public class TestDbContext : DbContext + { + public TestDbContext(DbConnection existingConnection, bool contextOwnsConnection) + : base(existingConnection, contextOwnsConnection) + { + } + + public DbSet Posts { get; set; } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.Entity().ToTable("posts", "public"); + modelBuilder.Entity().Property(c => c.Id).HasColumnName("id").IsOptional(); + modelBuilder.Entity().Property(c => c.Title).HasColumnName("title").IsOptional(); + modelBuilder.Entity().Property(c => c.Body).HasColumnName("body").IsOptional(); + modelBuilder.Entity().Property(c => c.UserName).HasColumnName("user_name").IsOptional(); + } + } + + public class Post + { + public int Id { get; set; } + public string Title { get; set; } + public string Body { get; set; } + public string UserName { get; set; } + } +} diff --git a/Npgsql.EntityFramework/packages.config b/Npgsql.EntityFramework/packages.config index 4fef52d215..fbdacc1a3b 100755 --- a/Npgsql.EntityFramework/packages.config +++ b/Npgsql.EntityFramework/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/tests/Npgsql.snk b/tests/Npgsql.snk new file mode 100644 index 0000000000000000000000000000000000000000..c54133da35e728475916ab2cb3d3a779f4534e75 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096iJXs4WPCYb!Xn5QY^wJ)%R;2_WB@AX4 z1Vb=z9W}{-c%|Q$rY(cXqT4M8B_pW(NfVeQOlyfUn~WXK^g14TpMH4^aTHc0 zf^T5g$mbl;CACzb7kk+?r+}6z@TafGcnx#tc+(5fz14awN}6Z5680)C6Jw-sjLQpV=(U0GFeE$Ff_yLJ$_NKK?IDb zW0({)$Zx46UC){!`Uav0fK)?<*^FZSUYc=-zN;Xv+0|4&6KM4e@G961d3|${VUA}YKFWQdZ8Utr%kmIW_ z$hKf-N&wOE2QJ8AK(3F4@zDOsnlo+Czp;#)9>DEUH!5w6JX5zU9}OMS3Dl~}l#0CR zn!QmahKG5f(pLI4hr*g5DO}Jl_+T$`DlQ-HtKZWhPgKA=Dl+A~pt_A-ugswv_UP1% iu|{4YuikGZvp4 v4.5 + + true + + + Npgsql.snk + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -175,6 +181,7 @@ + Always From 452d4037b3d35f7e557c75c41dfd9f801847386e Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 13:26:09 +0100 Subject: [PATCH 16/24] #116 Tests in NpgsqlTests Project --- Npgsql.EntityFramework/packages.config | 1 - tests/App.config | 20 +++++++++++++++++++ .../Tests => tests}/EntityFrameworkTests.cs | 4 ++-- tests/NpgsqlTests.csproj | 13 +++++++++++- tests/packages.config | 1 + 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 tests/App.config rename {Npgsql.EntityFramework/Tests => tests}/EntityFrameworkTests.cs (98%) diff --git a/Npgsql.EntityFramework/packages.config b/Npgsql.EntityFramework/packages.config index fbdacc1a3b..4fef52d215 100755 --- a/Npgsql.EntityFramework/packages.config +++ b/Npgsql.EntityFramework/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/tests/App.config b/tests/App.config new file mode 100644 index 0000000000..0ffd9db691 --- /dev/null +++ b/tests/App.config @@ -0,0 +1,20 @@ + + + + +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs b/tests/EntityFrameworkTests.cs similarity index 98% rename from Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs rename to tests/EntityFrameworkTests.cs index 7429fe6755..1da02a143a 100644 --- a/Npgsql.EntityFramework/Tests/EntityFrameworkTests.cs +++ b/tests/EntityFrameworkTests.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; -namespace Tests +namespace NpgsqlTests { public class EntityFrameworkTests : TestBase { @@ -121,7 +121,7 @@ where search_vector @@ to_tsquery('english', @p0) } [Test] - public void EntityFrameworkSqlQueryMapWithUnderscoreColumnNames() + public void DbContextSqlQueryMapWithUnderscoreColumnNames() { var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); conn.ConnectionString = ConnectionString; diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index 2f0ddf05d7..5dab10752a 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -132,12 +132,21 @@ v4.5 - true + false Npgsql.snk + + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll + + + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.SqlServer.dll + + + ..\..\..\manray\src\cs\CallForEntriesReader\packages\Npgsql.EntityFramework.dll + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -176,11 +185,13 @@ + + diff --git a/tests/packages.config b/tests/packages.config index 5c3ca54dd7..fbdacc1a3b 100644 --- a/tests/packages.config +++ b/tests/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file From 08a349f3b8f73a81ae2d2d7ae10b3d72166ae4ed Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 13:54:25 +0100 Subject: [PATCH 17/24] #116 fixing references Removing EntityFramework.SqlServer from NpgsTests --- tests/App.config | 3 --- tests/NpgsqlTests.csproj | 10 ++++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/App.config b/tests/App.config index 0ffd9db691..5f930c914c 100644 --- a/tests/App.config +++ b/tests/App.config @@ -3,14 +3,11 @@
- - - diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index 5dab10752a..c4f45284f0 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -141,12 +141,6 @@ ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll - - ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.SqlServer.dll - - - ..\..\..\manray\src\cs\CallForEntriesReader\packages\Npgsql.EntityFramework.dll - ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -232,6 +226,10 @@ + + {3ec85cba-5b79-11e3-8104-0022198ab089} + Npgsql.EntityFramework + {9D13B739-62B1-4190-B386-7A9547304EB3} Npgsql2012 From 86382127c4ffb11b6f27f31084d9c4aa0bc4516f Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 19:02:22 +0100 Subject: [PATCH 18/24] #116 Removing App.config Removing App.config from Npgsql.EntityFramework --- Npgsql.EntityFramework/App.config | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 Npgsql.EntityFramework/App.config diff --git a/Npgsql.EntityFramework/App.config b/Npgsql.EntityFramework/App.config deleted file mode 100644 index fd2b8f7c84..0000000000 --- a/Npgsql.EntityFramework/App.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - -
- - - - - - - - - - - - \ No newline at end of file From b326be28fade42132f1214b8285841b446c69dbc Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 19:47:22 +0100 Subject: [PATCH 19/24] #116 removing the key file from the tests folder --- tests/Npgsql.snk | Bin 596 -> 0 bytes tests/NpgsqlTests.csproj | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 tests/Npgsql.snk diff --git a/tests/Npgsql.snk b/tests/Npgsql.snk deleted file mode 100644 index c54133da35e728475916ab2cb3d3a779f4534e75..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096iJXs4WPCYb!Xn5QY^wJ)%R;2_WB@AX4 z1Vb=z9W}{-c%|Q$rY(cXqT4M8B_pW(NfVeQOlyfUn~WXK^g14TpMH4^aTHc0 zf^T5g$mbl;CACzb7kk+?r+}6z@TafGcnx#tc+(5fz14awN}6Z5680)C6Jw-sjLQpV=(U0GFeE$Ff_yLJ$_NKK?IDb zW0({)$Zx46UC){!`Uav0fK)?<*^FZSUYc=-zN;Xv+0|4&6KM4e@G961d3|${VUA}YKFWQdZ8Utr%kmIW_ z$hKf-N&wOE2QJ8AK(3F4@zDOsnlo+Czp;#)9>DEUH!5w6JX5zU9}OMS3Dl~}l#0CR zn!QmahKG5f(pLI4hr*g5DO}Jl_+T$`DlQ-HtKZWhPgKA=Dl+A~pt_A-ugswv_UP1% iu|{4YuikGZvpfalse - Npgsql.snk + + @@ -186,7 +187,6 @@ - Always From 5a07ecb8f921f845d00ed3fabea0236d6465bff6 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 13 Dec 2013 21:42:21 +0100 Subject: [PATCH 20/24] #116 Add to app.config --- tests/App.config | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/App.config b/tests/App.config index 5f930c914c..77cb73eb24 100644 --- a/tests/App.config +++ b/tests/App.config @@ -11,6 +11,7 @@ + From 1efb8fd3f464a7c73e98fc6528697ebf90585e1a Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Mon, 16 Dec 2013 11:02:59 +0100 Subject: [PATCH 21/24] #116 ConvertToUnderscoreCase if the first comparison fails --- Npgsql/Npgsql/NpgsqlRowDescription.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Npgsql/Npgsql/NpgsqlRowDescription.cs b/Npgsql/Npgsql/NpgsqlRowDescription.cs index 067898d9ac..e213e2de8c 100644 --- a/Npgsql/Npgsql/NpgsqlRowDescription.cs +++ b/Npgsql/Npgsql/NpgsqlRowDescription.cs @@ -197,16 +197,21 @@ public int TryFieldIndex(string fieldName) public int FieldIndex(String fieldName) { int ret = -1; - string fieldNameUnderScore = ConvertToUnderscore(fieldName); + if (field_name_index_table.TryGetValue(fieldName, out ret) - || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret) - || field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) + || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret)) + return ret; + + string fieldNameUnderScore = ConvertToUnderscore(fieldName); + if(field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) || caseInsensitiveNameIndexTable.TryGetValue(fieldNameUnderScore, out ret)) return ret; - else if(_compatVersion < GET_ORDINAL_THROW_EXCEPTION) + + else if (_compatVersion < GET_ORDINAL_THROW_EXCEPTION) return -1; else throw new IndexOutOfRangeException("Field not found"); + } private string ConvertToUnderscore(string val) From 615c4a026339c504eaf0b21c68aa79b881d60213 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Fri, 20 Dec 2013 22:40:04 +0100 Subject: [PATCH 22/24] Windows integrated security #if directive for mono --- .../Npgsql.EntityFramework.csproj | 80 ++++++++++++++++++ .../Npgsql.EntityFrameworkLegacy.csproj | 84 ++++++++++++++++++- Npgsql/Npgsql.csproj | 84 ++++++++++++++++++- .../Npgsql/NpgsqlConnectionStringBuilder.cs | 19 +++-- Npgsql2013.sln | 70 +++++++++++++++- tests/NpgsqlTests.csproj | 60 +++++++++++++ 6 files changed, 384 insertions(+), 13 deletions(-) diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index b0599a4c54..a598fa0340 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -76,6 +76,86 @@ bin\Release-net40\Npgsql.EntityFramework.xml v4.0 + + bin\Mono-Release-net45\ + TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Release-net45\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Debug-net45\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Debug-net45\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 + bin\Debug-net40\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Debug-net45\Npgsql.EntityFramework.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Release-net45\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 + bin\Release-net45\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 + bin\Release-net40\Npgsql.EntityFramework.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll diff --git a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj index 965be3e111..b011c6754e 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj @@ -97,6 +97,86 @@ bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml v3.5 + + bin\Mono-Release-net45\ + TRACE;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35 + bin\Legacy-Debug-net35\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40 + bin\Legacy-Debug-net40\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45 + bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + TRACE;WINDOWS;UNMANAGED;NET35 + bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40 + bin\Legacy-Release-net40\Npgsql.EntityFrameworkLegacy.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + @@ -128,9 +208,7 @@ Code - - - + {9d13b739-62b1-4190-b386-7a9547304eb3} diff --git a/Npgsql/Npgsql.csproj b/Npgsql/Npgsql.csproj index cfce0670cf..c3545c2f77 100644 --- a/Npgsql/Npgsql.csproj +++ b/Npgsql/Npgsql.csproj @@ -122,6 +122,86 @@ bin\Release-net20\Npgsql.xml v2.0 + + bin\Mono-Release-net45\ + TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES + bin\Release-net45\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + TRACE;DEBUG;WINDOWS;UNMANAGED + bin\Debug-net20\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;ENTITIES + bin\Debug-net35\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES + bin\Debug-net40\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES + bin\Debug-net45\Npgsql.xml + full + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + TRACE;WINDOWS;UNMANAGED + bin\Release-net20\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + TRACE;WINDOWS;UNMANAGED;NET35;ENTITIES + bin\Release-net35\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES + bin\Release-net40\Npgsql.xml + true + pdbonly + AnyCPU + prompt + ManagedMinimumRules.ruleset + @@ -130,12 +210,12 @@ - + ..\lib\Mono.Security\4.0\Mono.Security.dll - + ..\lib\Mono.Security\2.0\Mono.Security.dll diff --git a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs index 904928ecdf..407c55c26c 100644 --- a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs +++ b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs @@ -375,18 +375,25 @@ public string UserName { get { - if ((_integrated_security) && (String.IsNullOrEmpty(_username))) - { - System.Security.Principal.WindowsIdentity identity = - System.Security.Principal.WindowsIdentity.GetCurrent(); - _username = identity.Name.Split('\\')[1]; - } +#if WINDOWS + SetUsernameWindowsIntegratedSecurity(); +#endif return _username; } set { SetValue(GetKeyName(Keywords.UserName), Keywords.UserName, value); } } + private void SetUsernameWindowsIntegratedSecurity() + { + if ((_integrated_security) && (String.IsNullOrEmpty(_username))) + { + System.Security.Principal.WindowsIdentity identity = + System.Security.Principal.WindowsIdentity.GetCurrent(); + _username = identity.Name.Split('\\')[1]; + } + } + private PasswordBytes _password; /// /// Gets or sets the login password as a UTF8 encoded byte array. diff --git a/Npgsql2013.sln b/Npgsql2013.sln index 56b1de83ca..bde78eedca 100644 --- a/Npgsql2013.sln +++ b/Npgsql2013.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 +# Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Npgsql", "Npgsql\Npgsql.csproj", "{9D13B739-62B1-4190-B386-7A9547304EB3}" @@ -13,8 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlTests", "tests\Npgsql EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4A5A60DD-41B6-40BF-B677-227A921ECCC8}" ProjectSection(SolutionItems) = preProject - Npgsql.snk = Npgsql.snk CommonAssemblyInfo.cs = CommonAssemblyInfo.cs + Npgsql.snk = Npgsql.snk EndProjectSection EndProject Global @@ -23,6 +23,14 @@ Global Debug-net35|AnyCPU = Debug-net35|AnyCPU Debug-net40|AnyCPU = Debug-net40|AnyCPU Debug-net45|AnyCPU = Debug-net45|AnyCPU + Mono-Debug-net20|AnyCPU = Mono-Debug-net20|AnyCPU + Mono-Debug-net35|AnyCPU = Mono-Debug-net35|AnyCPU + Mono-Debug-net40|AnyCPU = Mono-Debug-net40|AnyCPU + Mono-Debug-net45|AnyCPU = Mono-Debug-net45|AnyCPU + Mono-Release-net20|AnyCPU = Mono-Release-net20|AnyCPU + Mono-Release-net35|AnyCPU = Mono-Release-net35|AnyCPU + Mono-Release-net40|AnyCPU = Mono-Release-net40|AnyCPU + Mono-Release-net45|AnyCPU = Mono-Release-net45|AnyCPU Release-net20|AnyCPU = Release-net20|AnyCPU Release-net35|AnyCPU = Release-net35|AnyCPU Release-net40|AnyCPU = Release-net40|AnyCPU @@ -37,6 +45,22 @@ Global {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU @@ -51,6 +75,18 @@ Global {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net40|AnyCPU.ActiveCfg = Release-net40|Any CPU @@ -64,6 +100,20 @@ Global {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.Build.0 = Release-net35|Any CPU @@ -79,6 +129,22 @@ Global {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU + {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index 37b50fc716..a5db98c39a 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -138,6 +138,66 @@ + + bin\Mono-Release-net45\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net20\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net35\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net40\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + true + bin\Mono-Debug-net45\ + true + full + AnyCPU + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net20\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net35\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + + + bin\Mono-Release-net40\ + true + true + AnyCPU + ManagedMinimumRules.ruleset + ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll From 87291a9977d7f25f598f8821cf61a356806379ff Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Sat, 21 Dec 2013 16:16:12 +0100 Subject: [PATCH 23/24] Revert "Windows integrated security #if directive for mono" This reverts commit af0548a13ba13d2194f1857d73ebcaf258087d5b. --- .../Npgsql.EntityFramework.csproj | 80 ------------------ .../Npgsql.EntityFrameworkLegacy.csproj | 84 +------------------ Npgsql/Npgsql.csproj | 84 +------------------ .../Npgsql/NpgsqlConnectionStringBuilder.cs | 19 ++--- Npgsql2013.sln | 70 +--------------- tests/NpgsqlTests.csproj | 60 ------------- 6 files changed, 13 insertions(+), 384 deletions(-) diff --git a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj index a598fa0340..b0599a4c54 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFramework.csproj @@ -76,86 +76,6 @@ bin\Release-net40\Npgsql.EntityFramework.xml v4.0 - - bin\Mono-Release-net45\ - TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Release-net45\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Debug-net45\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Debug-net45\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 - bin\Debug-net40\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Debug-net45\Npgsql.EntityFramework.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Release-net45\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES6 - bin\Release-net45\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES6 - bin\Release-net40\Npgsql.EntityFramework.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll diff --git a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj index b011c6754e..965be3e111 100644 --- a/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj +++ b/Npgsql.EntityFramework/Npgsql.EntityFrameworkLegacy.csproj @@ -97,86 +97,6 @@ bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml v3.5 - - bin\Mono-Release-net45\ - TRACE;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35 - bin\Legacy-Debug-net35\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40 - bin\Legacy-Debug-net40\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Debug-net45\Npgsql.EntityFrameworkLegacy.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;NET45 - bin\Legacy-Release-net45\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - TRACE;WINDOWS;UNMANAGED;NET35 - bin\Legacy-Release-net35\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40 - bin\Legacy-Release-net40\Npgsql.EntityFrameworkLegacy.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - @@ -208,7 +128,9 @@ Code - + + + {9d13b739-62b1-4190-b386-7a9547304eb3} diff --git a/Npgsql/Npgsql.csproj b/Npgsql/Npgsql.csproj index c3545c2f77..cfce0670cf 100644 --- a/Npgsql/Npgsql.csproj +++ b/Npgsql/Npgsql.csproj @@ -122,86 +122,6 @@ bin\Release-net20\Npgsql.xml v2.0 - - bin\Mono-Release-net45\ - TRACE;UNMANAGED;NET35;NET40;NET45;ENTITIES - bin\Release-net45\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - TRACE;DEBUG;WINDOWS;UNMANAGED - bin\Debug-net20\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;ENTITIES - bin\Debug-net35\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES - bin\Debug-net40\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - TRACE;DEBUG;WINDOWS;UNMANAGED;NET35;NET40;NET45;ENTITIES - bin\Debug-net45\Npgsql.xml - full - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - TRACE;WINDOWS;UNMANAGED - bin\Release-net20\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - TRACE;WINDOWS;UNMANAGED;NET35;ENTITIES - bin\Release-net35\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - TRACE;WINDOWS;UNMANAGED;NET35;NET40;ENTITIES - bin\Release-net40\Npgsql.xml - true - pdbonly - AnyCPU - prompt - ManagedMinimumRules.ruleset - @@ -210,12 +130,12 @@ - + ..\lib\Mono.Security\4.0\Mono.Security.dll - + ..\lib\Mono.Security\2.0\Mono.Security.dll diff --git a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs index 407c55c26c..904928ecdf 100644 --- a/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs +++ b/Npgsql/Npgsql/NpgsqlConnectionStringBuilder.cs @@ -375,25 +375,18 @@ public string UserName { get { -#if WINDOWS - SetUsernameWindowsIntegratedSecurity(); -#endif + if ((_integrated_security) && (String.IsNullOrEmpty(_username))) + { + System.Security.Principal.WindowsIdentity identity = + System.Security.Principal.WindowsIdentity.GetCurrent(); + _username = identity.Name.Split('\\')[1]; + } return _username; } set { SetValue(GetKeyName(Keywords.UserName), Keywords.UserName, value); } } - private void SetUsernameWindowsIntegratedSecurity() - { - if ((_integrated_security) && (String.IsNullOrEmpty(_username))) - { - System.Security.Principal.WindowsIdentity identity = - System.Security.Principal.WindowsIdentity.GetCurrent(); - _username = identity.Name.Split('\\')[1]; - } - } - private PasswordBytes _password; /// /// Gets or sets the login password as a UTF8 encoded byte array. diff --git a/Npgsql2013.sln b/Npgsql2013.sln index bde78eedca..56b1de83ca 100644 --- a/Npgsql2013.sln +++ b/Npgsql2013.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop +# Visual Studio 2013 VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Npgsql", "Npgsql\Npgsql.csproj", "{9D13B739-62B1-4190-B386-7A9547304EB3}" @@ -13,8 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlTests", "tests\Npgsql EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4A5A60DD-41B6-40BF-B677-227A921ECCC8}" ProjectSection(SolutionItems) = preProject - CommonAssemblyInfo.cs = CommonAssemblyInfo.cs Npgsql.snk = Npgsql.snk + CommonAssemblyInfo.cs = CommonAssemblyInfo.cs EndProjectSection EndProject Global @@ -23,14 +23,6 @@ Global Debug-net35|AnyCPU = Debug-net35|AnyCPU Debug-net40|AnyCPU = Debug-net40|AnyCPU Debug-net45|AnyCPU = Debug-net45|AnyCPU - Mono-Debug-net20|AnyCPU = Mono-Debug-net20|AnyCPU - Mono-Debug-net35|AnyCPU = Mono-Debug-net35|AnyCPU - Mono-Debug-net40|AnyCPU = Mono-Debug-net40|AnyCPU - Mono-Debug-net45|AnyCPU = Mono-Debug-net45|AnyCPU - Mono-Release-net20|AnyCPU = Mono-Release-net20|AnyCPU - Mono-Release-net35|AnyCPU = Mono-Release-net35|AnyCPU - Mono-Release-net40|AnyCPU = Mono-Release-net40|AnyCPU - Mono-Release-net45|AnyCPU = Mono-Release-net45|AnyCPU Release-net20|AnyCPU = Release-net20|AnyCPU Release-net35|AnyCPU = Release-net35|AnyCPU Release-net40|AnyCPU = Release-net40|AnyCPU @@ -45,22 +37,6 @@ Global {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {9D13B739-62B1-4190-B386-7A9547304EB3}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {9D13B739-62B1-4190-B386-7A9547304EB3}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU @@ -75,18 +51,6 @@ Global {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {3EC85CBA-5B79-11E3-8104-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net45|Any CPU {3EC85CBA-5B79-11E3-8104-0022198AB089}.Release-net40|AnyCPU.ActiveCfg = Release-net40|Any CPU @@ -100,20 +64,6 @@ Global {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {100998C4-5B85-11E3-911C-0022198AB089}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net20|AnyCPU.ActiveCfg = Release-net45|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU {100998C4-5B85-11E3-911C-0022198AB089}.Release-net35|AnyCPU.Build.0 = Release-net35|Any CPU @@ -129,22 +79,6 @@ Global {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net40|AnyCPU.Build.0 = Debug-net40|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.ActiveCfg = Debug-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Debug-net45|AnyCPU.Build.0 = Debug-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.ActiveCfg = Mono-Debug-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net20|AnyCPU.Build.0 = Mono-Debug-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.ActiveCfg = Mono-Debug-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net35|AnyCPU.Build.0 = Mono-Debug-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.ActiveCfg = Mono-Debug-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net40|AnyCPU.Build.0 = Mono-Debug-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.ActiveCfg = Mono-Debug-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Debug-net45|AnyCPU.Build.0 = Mono-Debug-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.ActiveCfg = Mono-Release-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net20|AnyCPU.Build.0 = Mono-Release-net20|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.ActiveCfg = Mono-Release-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net35|AnyCPU.Build.0 = Mono-Release-net35|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.ActiveCfg = Mono-Release-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net40|AnyCPU.Build.0 = Mono-Release-net40|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.ActiveCfg = Mono-Release-net45|Any CPU - {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Mono-Release-net45|AnyCPU.Build.0 = Mono-Release-net45|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.ActiveCfg = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net20|AnyCPU.Build.0 = Release-net20|Any CPU {E9C258D7-0D8E-4E6A-9857-5C6438591755}.Release-net35|AnyCPU.ActiveCfg = Release-net35|Any CPU diff --git a/tests/NpgsqlTests.csproj b/tests/NpgsqlTests.csproj index a5db98c39a..37b50fc716 100644 --- a/tests/NpgsqlTests.csproj +++ b/tests/NpgsqlTests.csproj @@ -138,66 +138,6 @@ - - bin\Mono-Release-net45\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net20\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net35\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net40\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - true - bin\Mono-Debug-net45\ - true - full - AnyCPU - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net20\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net35\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - - - bin\Mono-Release-net40\ - true - true - AnyCPU - ManagedMinimumRules.ruleset - ..\packages\EntityFramework.6.0.1\lib\net40\EntityFramework.dll From 6a5a9d250ed49fa3d1b24c7bb331083bafc40d54 Mon Sep 17 00:00:00 2001 From: "Juan J. Chiw" Date: Mon, 23 Dec 2013 13:19:51 +0100 Subject: [PATCH 24/24] Fixing rootnamespace --- Npgsql.EntityFramework/NpgsqlProviderManifest.cs | 6 +++--- Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs | 2 +- Npgsql/Npgsql/NpgsqlRowDescription.cs | 11 ----------- tests/EntityFrameworkTests.cs | 8 +++----- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Npgsql.EntityFramework/NpgsqlProviderManifest.cs b/Npgsql.EntityFramework/NpgsqlProviderManifest.cs index 0d4351522e..6ff4223075 100644 --- a/Npgsql.EntityFramework/NpgsqlProviderManifest.cs +++ b/Npgsql.EntityFramework/NpgsqlProviderManifest.cs @@ -16,7 +16,7 @@ namespace Npgsql internal class NpgsqlProviderManifest : DbXmlEnabledProviderManifest { public NpgsqlProviderManifest(string serverVersion) - : base(CreateXmlReaderForResource("NpgsqlProviderManifest.Manifest.xml")) + : base(CreateXmlReaderForResource("Npgsql.NpgsqlProviderManifest.Manifest.xml")) { } @@ -26,11 +26,11 @@ protected override XmlReader GetDbInformation(string informationType) if (informationType == StoreSchemaDefinition) { - xmlReader = CreateXmlReaderForResource("NpgsqlSchema.ssdl"); + xmlReader = CreateXmlReaderForResource("Npgsql.NpgsqlSchema.ssdl"); } else if (informationType == StoreSchemaMapping) { - xmlReader = CreateXmlReaderForResource("NpgsqlSchema.msl"); + xmlReader = CreateXmlReaderForResource("Npgsql.NpgsqlSchema.msl"); } if (xmlReader == null) diff --git a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs index 735beab304..647e8bc363 100644 --- a/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs +++ b/Npgsql/Npgsql/NpgsqlCommand.Rewrite.cs @@ -654,7 +654,7 @@ private void AppendCommandReplacingParameterValues(Stream dest, string src, int break; case TokenType.Param : - if (IsParamNameChar(ch) || ch == '@') //Accept operator @@ for FullTextSearch + if (IsParamNameChar(ch)) { currTokenLen++; } diff --git a/Npgsql/Npgsql/NpgsqlRowDescription.cs b/Npgsql/Npgsql/NpgsqlRowDescription.cs index e213e2de8c..7bff80000e 100644 --- a/Npgsql/Npgsql/NpgsqlRowDescription.cs +++ b/Npgsql/Npgsql/NpgsqlRowDescription.cs @@ -201,23 +201,12 @@ public int FieldIndex(String fieldName) if (field_name_index_table.TryGetValue(fieldName, out ret) || caseInsensitiveNameIndexTable.TryGetValue(fieldName, out ret)) return ret; - - string fieldNameUnderScore = ConvertToUnderscore(fieldName); - if(field_name_index_table.TryGetValue(fieldNameUnderScore, out ret) - || caseInsensitiveNameIndexTable.TryGetValue(fieldNameUnderScore, out ret)) - return ret; - else if (_compatVersion < GET_ORDINAL_THROW_EXCEPTION) return -1; else throw new IndexOutOfRangeException("Field not found"); } - - private string ConvertToUnderscore(string val) - { - return Regex.Replace(val, @"(\p{Ll})(\p{Lu})", "$1_$2"); - } } internal sealed class NpgsqlRowDescriptionV2 : NpgsqlRowDescription diff --git a/tests/EntityFrameworkTests.cs b/tests/EntityFrameworkTests.cs index 1da02a143a..490aec9e70 100644 --- a/tests/EntityFrameworkTests.cs +++ b/tests/EntityFrameworkTests.cs @@ -121,17 +121,15 @@ where search_vector @@ to_tsquery('english', @p0) } [Test] - public void DbContextSqlQueryMapWithUnderscoreColumnNames() + public void FirstOrDefaultTest() { var conn = Npgsql.NpgsqlFactory.Instance.CreateConnection(); conn.ConnectionString = ConnectionString; using (var ctx = new TestDbContext(conn, true)) { - var query = @"select * from posts"; - var posts = ctx.Database.SqlQuery(query).ToList(); + var post = ctx.Posts.FirstOrDefault(); - Assert.AreEqual(6, posts.Count); - Assert.AreEqual("Clark Kent", posts.FirstOrDefault().UserName); + Assert.AreEqual("Clark Kent", post.UserName); } } }