Visitar URL original
Merge branch 'hotfix/3.0.3' · ncoder/npgsql@7ca02e9 · GitHub
Skip to content

Commit 7ca02e9

Browse files
committed
Merge branch 'hotfix/3.0.3'
2 parents a249ec7 + 71dbd7e commit 7ca02e9

22 files changed

Lines changed: 513 additions & 139 deletions

‎.gitattributes‎

100644100755
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
* text=auto
22

3-
*.cs text diff=csharp
4-
*.csproj text
5-
*.sln text
6-
*.resx text
7-
*.xml text
8-
*.txt text
3+
*.cs text=auto diff=csharp
4+
*.csproj text=auto
5+
*.sln text=auto
6+
*.resx text=auto
7+
*.xml text=auto
8+
*.txt text=auto
99

1010
packages/ binary

‎.teamcity/npgsql/buildTypes/npgsql.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ src\EntityFramework6.Npgsql\EntityFramework5.Npgsql.nuspec]]></param>
139139
<parameters>
140140
<param name="nuget.path" value="?NuGet.CommandLine.DEFAULT.nupkg" />
141141
<param name="nuget.publish.files"><![CDATA[nupkgs/*.nupkg]]></param>
142-
<param name="nuget.publish.source" value="https://www.myget.org/F/npgsql-unstable" />
142+
<param name="nuget.publish.source" value="https://www.myget.org/F/npgsql" />
143143
<param name="nugetCustomPath" value="?NuGet.CommandLine.DEFAULT.nupkg" />
144144
<param name="nugetPathSelector" value="?NuGet.CommandLine.DEFAULT.nupkg" />
145145
<param name="secure:nuget.api.key" value="zxxca89988ce5b6f9ad529c572cd56e162ccda4fdff046b0cdb8bff3560c8e35dcbda3e64637e4ca2f1" />

‎src/EntityFramework6.Npgsql/EntityFramework5.Npgsql.nuspec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<owners>Shay Rojansky, Emil Lenngren, Francisco Figueiredo Jr., Kenji Uno</owners>
99
<licenseUrl>https://github.com/npgsql/npgsql/blob/develop/LICENSE.txt</licenseUrl>
1010
<projectUrl>http://www.npgsql.org</projectUrl>
11+
<iconUrl>http://www.npgsql.org/img/postgresql.gif</iconUrl>
1112
<copyright>Copyright 2002 - 2015 Npgsql Development Team</copyright>
1213
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1314
<description>PostgreSQL provider for Entity Framework 5</description>

‎src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.nuspec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<owners>Shay Rojansky, Emil Lenngren, Francisco Figueiredo Jr., Kenji Uno</owners>
99
<licenseUrl>https://github.com/npgsql/npgsql/blob/develop/LICENSE.txt</licenseUrl>
1010
<projectUrl>http://www.npgsql.org</projectUrl>
11+
<iconUrl>http://www.npgsql.org/img/postgresql.gif</iconUrl>
1112
<copyright>Copyright 2002 - 2015 Npgsql Development Team</copyright>
1213
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1314
<description>PostgreSQL provider for Entity Framework 6</description>

‎src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,19 @@ private VisitedExpression VisitFunction(EdmFunction function, IList<DbExpression
11191119
throw new NotSupportedException("NotSupported " + function.Name);
11201120
}
11211121
}
1122+
1123+
#if ENTITIES6
1124+
FunctionExpression customFuncCall = string.IsNullOrEmpty(function.Schema) ?
1125+
new FunctionExpression(QuoteIdentifier(function.StoreFunctionNameAttribute)) :
1126+
new FunctionExpression(
1127+
QuoteIdentifier(function.Schema) + "." + QuoteIdentifier(function.StoreFunctionNameAttribute));
1128+
1129+
foreach (var a in args)
1130+
customFuncCall.AddArgument(a.Accept(this));
1131+
return customFuncCall;
1132+
#else
11221133
throw new NotSupportedException();
1134+
#endif
11231135
}
11241136

11251137
private VisitedExpression Substring(VisitedExpression source, VisitedExpression start, VisitedExpression count)

‎src/Npgsql/BackendMessages/ErrorOrNoticeMessage.cs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class ErrorOrNoticeMessage
5151
internal string Line { get; private set; }
5252
internal string Routine { get; private set; }
5353

54-
ErrorOrNoticeMessage(SerializationInfo info, StreamingContext context) { }
55-
5654
// ReSharper disable once FunctionComplexityOverflow
5755
internal ErrorOrNoticeMessage(NpgsqlBuffer buf)
5856
{

‎src/Npgsql/Logging/ConsoleLoggingProvider.cs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ public override bool IsEnabled(NpgsqlLogLevel level)
7979

8080
public override void Log(NpgsqlLogLevel level, int connectorId, string msg, Exception exception = null)
8181
{
82+
if (!IsEnabled(level)) {
83+
return;
84+
}
85+
8286
var sb = new StringBuilder();
8387
if (_printLevel) {
8488
sb.Append(level.ToString().ToUpper());

‎src/Npgsql/Npgsql.nuspec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<owners>Shay Rojansky, Emil Lenngren, Francisco Figueiredo Jr., Kenji Uno</owners>
99
<licenseUrl>https://github.com/npgsql/npgsql/blob/develop/LICENSE.txt</licenseUrl>
1010
<projectUrl>http://www.npgsql.org</projectUrl>
11+
<iconUrl>http://www.npgsql.org/img/postgresql.gif</iconUrl>
1112
<copyright>Copyright 2002 - 2015 Npgsql Development Team</copyright>
1213
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1314
<description>Npgsql is a .NET data provider for PostgreSQL, 100% implemented in C# code. PostgreSQL 9.x and above is officially supported, other versions may work.</description>

‎src/Npgsql/NpgsqlCommand.cs‎

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -794,16 +794,18 @@ public override int ExecuteNonQuery()
794794
public override async Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken)
795795
{
796796
cancellationToken.ThrowIfCancellationRequested();
797-
cancellationToken.Register(Cancel);
798-
try
799-
{
800-
return await ExecuteNonQueryInternalAsync().ConfigureAwait(false);
801-
}
802-
catch (NpgsqlException e)
797+
using (cancellationToken.Register(Cancel))
803798
{
804-
if (e.Code == "57014")
805-
throw new TaskCanceledException(e.Message);
806-
throw;
799+
try
800+
{
801+
return await ExecuteNonQueryInternalAsync().ConfigureAwait(false);
802+
}
803+
catch (NpgsqlException e)
804+
{
805+
if (e.Code == "57014")
806+
throw new TaskCanceledException(e.Message);
807+
throw;
808+
}
807809
}
808810
}
809811

@@ -849,16 +851,18 @@ public override object ExecuteScalar()
849851
public override async Task<object> ExecuteScalarAsync(CancellationToken cancellationToken)
850852
{
851853
cancellationToken.ThrowIfCancellationRequested();
852-
cancellationToken.Register(Cancel);
853-
try
854+
using (cancellationToken.Register(Cancel))
854855
{
855-
return await ExecuteScalarInternalAsync().ConfigureAwait(false);
856-
}
857-
catch (NpgsqlException e)
858-
{
859-
if (e.Code == "57014")
860-
throw new TaskCanceledException(e.Message);
861-
throw;
856+
try
857+
{
858+
return await ExecuteScalarInternalAsync().ConfigureAwait(false);
859+
}
860+
catch (NpgsqlException e)
861+
{
862+
if (e.Code == "57014")
863+
throw new TaskCanceledException(e.Message);
864+
throw;
865+
}
862866
}
863867
}
864868

@@ -919,16 +923,18 @@ object ExecuteScalarInternal()
919923
protected async override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
920924
{
921925
cancellationToken.ThrowIfCancellationRequested();
922-
cancellationToken.Register(Cancel);
923-
try
924-
{
925-
return await ExecuteDbDataReaderInternalAsync(behavior).ConfigureAwait(false);
926-
}
927-
catch (NpgsqlException e)
926+
using (cancellationToken.Register(Cancel))
928927
{
929-
if (e.Code == "57014")
930-
throw new TaskCanceledException(e.Message);
931-
throw;
928+
try
929+
{
930+
return await ExecuteDbDataReaderInternalAsync(behavior).ConfigureAwait(false);
931+
}
932+
catch (NpgsqlException e)
933+
{
934+
if (e.Code == "57014")
935+
throw new TaskCanceledException(e.Message);
936+
throw;
937+
}
932938
}
933939
}
934940

‎src/Npgsql/NpgsqlConnection.cs‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ public override void Open()
166166
throw new ArgumentException("Host can't be null");
167167
if (string.IsNullOrWhiteSpace(UserName) && !IntegratedSecurity)
168168
throw new ArgumentException("Either Username must be specified or IntegratedSecurity must be on");
169-
if (Settings.Password == null && !IntegratedSecurity)
170-
throw new ArgumentException("Either password must be specified or IntegratedSecurity must be on");
171169
if (ContinuousProcessing && UseSslStream)
172170
throw new ArgumentException("ContinuousProcessing can't be turned on with UseSslStream");
173171
Contract.EndContractBlock();
@@ -583,9 +581,6 @@ internal void ReallyClose()
583581
else
584582
{
585583
Connector.Close();
586-
587-
Connector.ProvideClientCertificatesCallback = null;
588-
Connector.UserCertificateValidationCallback = null;
589584
}
590585

591586
Connector = null;
@@ -1065,6 +1060,11 @@ public static void RegisterEnumGlobally<TEnum>(string pgName = null) where TEnum
10651060
TypeHandlerRegistry.RegisterEnumTypeGlobally<TEnum>(pgName ?? typeof(TEnum).Name.ToLower());
10661061
}
10671062

1063+
internal static void UnregisterEnumGlobally<TEnum>() where TEnum : struct
1064+
{
1065+
TypeHandlerRegistry.UnregisterEnumTypeGlobally<TEnum>();
1066+
}
1067+
10681068
#endregion
10691069

10701070
#region State checks
@@ -1209,7 +1209,10 @@ public override DataTable GetSchema(string collectionName, string[] restrictions
12091209
object ICloneable.Clone()
12101210
{
12111211
CheckNotDisposed();
1212-
return new NpgsqlConnection(ConnectionString);
1212+
return new NpgsqlConnection(ConnectionString) {
1213+
ProvideClientCertificatesCallback = ProvideClientCertificatesCallback,
1214+
UserCertificateValidationCallback = UserCertificateValidationCallback
1215+
};
12131216
}
12141217

12151218
/// <summary>

0 commit comments

Comments
 (0)