Skip to content

Commit f97404a

Browse files
Update NHibernate to 5.1.0 (#46)
1 parent 7bbfa35 commit f97404a

File tree

35 files changed

+190
-321
lines changed

35 files changed

+190
-321
lines changed

CoreDistributedCache/NHibernate.Caches.CoreDistributedCache.Memcached/NHibernate.Caches.CoreDistributedCache.Memcached.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
99
<SignAssembly>False</SignAssembly>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11-
<PackageReleaseNotes>* New feature
12-
* #28 - Add a .Net Core DistributedCache</PackageReleaseNotes>
11+
<PackageReleaseNotes>* Task
12+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1313
</PropertyGroup>
1414
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
1515
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>

CoreDistributedCache/NHibernate.Caches.CoreDistributedCache.Memory/NHibernate.Caches.CoreDistributedCache.Memory.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Meant for testing purpose, consider NHibernate.Caches.CoreMemoryCache for other
1010
<SignAssembly>True</SignAssembly>
1111
<AssemblyOriginatorKeyFile>..\..\NHibernate.Caches.snk</AssemblyOriginatorKeyFile>
1212
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13-
<PackageReleaseNotes>* New feature
14-
* #28 - Add a .Net Core DistributedCache</PackageReleaseNotes>
13+
<PackageReleaseNotes>* Task
14+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1515
</PropertyGroup>
1616
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
1717
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>

CoreDistributedCache/NHibernate.Caches.CoreDistributedCache.Redis/NHibernate.Caches.CoreDistributedCache.Redis.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<SignAssembly>True</SignAssembly>
1010
<AssemblyOriginatorKeyFile>..\..\NHibernate.Caches.snk</AssemblyOriginatorKeyFile>
1111
<GenerateDocumentationFile>true</GenerateDocumentationFile>
12-
<PackageReleaseNotes>* New feature
13-
* #28 - Add a .Net Core DistributedCache</PackageReleaseNotes>
12+
<PackageReleaseNotes>* Task
13+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1414
</PropertyGroup>
1515
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
1616
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>

CoreDistributedCache/NHibernate.Caches.CoreDistributedCache.SqlServer/NHibernate.Caches.CoreDistributedCache.SqlServer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<SignAssembly>True</SignAssembly>
1010
<AssemblyOriginatorKeyFile>..\..\NHibernate.Caches.snk</AssemblyOriginatorKeyFile>
1111
<GenerateDocumentationFile>true</GenerateDocumentationFile>
12-
<PackageReleaseNotes>* New feature
13-
* #28 - Add a .Net Core DistributedCache</PackageReleaseNotes>
12+
<PackageReleaseNotes>* Task
13+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1414
</PropertyGroup>
1515
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
1616
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>

CoreDistributedCache/NHibernate.Caches.CoreDistributedCache/NHibernate.Caches.CoreDistributedCache.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ This provider is not bound to a specific implementation and require a cache fact
1010
<SignAssembly>True</SignAssembly>
1111
<AssemblyOriginatorKeyFile>..\..\NHibernate.Caches.snk</AssemblyOriginatorKeyFile>
1212
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13-
<PackageReleaseNotes>* New feature
14-
* #28 - Add a .Net Core DistributedCache</PackageReleaseNotes>
13+
<PackageReleaseNotes>* Task
14+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1515
</PropertyGroup>
1616
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
1717
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>
@@ -21,7 +21,6 @@ This provider is not bound to a specific implementation and require a cache fact
2121
<None Include="..\default.build" Link="default.build" />
2222
</ItemGroup>
2323
<ItemGroup>
24-
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
2524
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.0.0" />
2625
<PackageReference Include="NHibernate" Version="5.1.0" />
2726
</ItemGroup>

CoreMemoryCache/NHibernate.Caches.CoreMemoryCache/NHibernate.Caches.CoreMemoryCache.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<SignAssembly>True</SignAssembly>
1111
<AssemblyOriginatorKeyFile>..\..\NHibernate.Caches.snk</AssemblyOriginatorKeyFile>
1212
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13-
<PackageReleaseNotes>* New feature
14-
* #25 - Add a .Net Core MemoryCache</PackageReleaseNotes>
13+
<PackageReleaseNotes>* Task
14+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1515
</PropertyGroup>
1616
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
1717
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>
@@ -21,7 +21,6 @@
2121
<None Include="..\default.build" Link="default.build" />
2222
</ItemGroup>
2323
<ItemGroup>
24-
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
2524
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.0.0" />
2625
<PackageReference Include="NHibernate" Version="5.1.0" />
2726
</ItemGroup>

EnyimMemcached/NHibernate.Caches.EnyimMemcached/MemCacheClient.cs

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace NHibernate.Caches.EnyimMemcached
1515
/// </summary>
1616
public partial class MemCacheClient : ICache
1717
{
18-
private static readonly IInternalLogger log;
18+
private static readonly INHibernateLogger log;
1919
[ThreadStatic] private static HashAlgorithm hasher;
2020

2121
[ThreadStatic] private static MD5 md5;
@@ -27,7 +27,7 @@ public partial class MemCacheClient : ICache
2727

2828
static MemCacheClient()
2929
{
30-
log = LoggerProvider.LoggerFor(typeof (MemCacheClient));
30+
log = NHibernateLogger.For(typeof(MemCacheClient));
3131
}
3232

3333
/// <summary>
@@ -78,26 +78,17 @@ public MemCacheClient(string regionName, IDictionary<string, string> properties,
7878
if (expirationString != null)
7979
{
8080
expiry = Convert.ToInt32(expirationString);
81-
if (log.IsDebugEnabled)
82-
{
83-
log.DebugFormat("using expiration of {0} seconds", expiry);
84-
}
81+
log.Debug("using expiration of {0} seconds", expiry);
8582
}
8683

8784
if (properties.ContainsKey("regionPrefix"))
8885
{
8986
regionPrefix = properties["regionPrefix"];
90-
if (log.IsDebugEnabled)
91-
{
92-
log.DebugFormat("new regionPrefix :{0}", regionPrefix);
93-
}
87+
log.Debug("new regionPrefix :{0}", regionPrefix);
9488
}
9589
else
9690
{
97-
if (log.IsDebugEnabled)
98-
{
99-
log.Debug("no regionPrefix value given, using defaults");
100-
}
91+
log.Debug("no regionPrefix value given, using defaults");
10192
}
10293
}
10394
}
@@ -135,10 +126,7 @@ public object Get(object key)
135126
{
136127
return null;
137128
}
138-
if (log.IsDebugEnabled)
139-
{
140-
log.DebugFormat("fetching object {0} from the cache", key);
141-
}
129+
log.Debug("fetching object {0} from the cache", key);
142130
object maybeObj = client.Get(KeyAsString(key));
143131
if (maybeObj == null)
144132
{
@@ -168,20 +156,14 @@ public void Put(object key, object value)
168156
throw new ArgumentNullException("value", "null value not allowed");
169157
}
170158

171-
if (log.IsDebugEnabled)
172-
{
173-
log.DebugFormat("setting value for item {0}", key);
174-
}
159+
log.Debug("setting value for item {0}", key);
175160
bool returnOk = client.Store(
176161
StoreMode.Set, KeyAsString(key),
177162
new DictionaryEntry(GetAlternateKeyHash(key), value),
178163
TimeSpan.FromSeconds(expiry));
179164
if (!returnOk)
180165
{
181-
if (log.IsWarnEnabled)
182-
{
183-
log.WarnFormat("could not save: {0} => {1}", key, value);
184-
}
166+
log.Warn("could not save: {0} => {1}", key, value);
185167
}
186168
}
187169

@@ -192,10 +174,7 @@ public void Remove(object key)
192174
{
193175
throw new ArgumentNullException("key");
194176
}
195-
if (log.IsDebugEnabled)
196-
{
197-
log.DebugFormat("removing item {0}", key);
198-
}
177+
log.Debug("removing item {0}", key);
199178
client.Remove(KeyAsString(key));
200179
}
201180

EnyimMemcached/NHibernate.Caches.EnyimMemcached/MemCacheProvider.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace NHibernate.Caches.EnyimMemcached
1414
/// </summary>
1515
public class MemCacheProvider : ICacheProvider
1616
{
17-
private static readonly IInternalLogger log;
17+
private static readonly INHibernateLogger log;
1818
private static MemcachedClient clientInstance;
1919
private static readonly IMemcachedClientConfiguration config;
2020
private static readonly object syncObject = new object();
2121
private static int _usageCount;
2222

2323
static MemCacheProvider()
2424
{
25-
log = LoggerProvider.LoggerFor(typeof (MemCacheProvider));
25+
log = NHibernateLogger.For(typeof(MemCacheProvider));
2626
config = ConfigurationManager.GetSection("enyim.com/memcached") as IMemcachedClientConfiguration;
2727
if (config == null)
2828
{
@@ -45,7 +45,7 @@ public ICache BuildCache(string regionName, IDictionary<string, string> properti
4545
{
4646
properties = new Dictionary<string, string>();
4747
}
48-
if (log.IsDebugEnabled)
48+
if (log.IsDebugEnabled())
4949
{
5050
var sb = new StringBuilder();
5151
foreach (var pair in properties)
@@ -56,7 +56,7 @@ public ICache BuildCache(string regionName, IDictionary<string, string> properti
5656
sb.Append(pair.Value);
5757
sb.Append(";");
5858
}
59-
log.Debug("building cache with region: " + regionName + ", properties: " + sb);
59+
log.Debug("building cache with region: {0}, properties: {1}", regionName, sb);
6060
}
6161
return new MemCacheClient(regionName, properties, clientInstance);
6262
}

EnyimMemcached/NHibernate.Caches.EnyimMemcached/NHibernate.Caches.EnyimMemcached.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@
88
<SignAssembly>True</SignAssembly>
99
<AssemblyOriginatorKeyFile>..\..\NHibernate.Caches.snk</AssemblyOriginatorKeyFile>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11-
<PackageReleaseNotes>* Improvement
12-
* #33 - Generate XML comment documentation</PackageReleaseNotes>
11+
<PackageReleaseNotes>* Task
12+
* #46 - Update NHibernate to 5.1.0</PackageReleaseNotes>
1313
</PropertyGroup>
1414
<ItemGroup>
1515
<None Include="..\..\NHibernate.Caches.snk" Link="NHibernate.snk" />
1616
<None Include="..\default.build" Link="default.build" />
1717
</ItemGroup>
1818
<ItemGroup>
1919
<PackageReference Include="EnyimMemcached" Version="2.12.0" />
20-
<PackageReference Include="Iesi.Collections" Version="4.0.2" />
21-
<PackageReference Include="NHibernate" Version="5.0.0" />
20+
<PackageReference Include="NHibernate" Version="5.1.0" />
2221
</ItemGroup>
2322
<ItemGroup>
2423
<Reference Include="System.Configuration" />

MemCache/NHibernate.Caches.MemCache/MemCacheClient.cs

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace NHibernate.Caches.MemCache
4040
public partial class MemCacheClient : ICache
4141
{
4242
internal const string PoolName = "nhibernate";
43-
private static readonly IInternalLogger log;
43+
private static readonly INHibernateLogger log;
4444
[ThreadStatic] private static HashAlgorithm hasher;
4545

4646
[ThreadStatic] private static MD5 md5;
@@ -53,7 +53,7 @@ public partial class MemCacheClient : ICache
5353

5454
static MemCacheClient()
5555
{
56-
log = LoggerProvider.LoggerFor(typeof(MemCacheClient));
56+
log = NHibernateLogger.For(typeof(MemCacheClient));
5757
}
5858

5959
/// <summary>
@@ -87,46 +87,31 @@ public MemCacheClient(string regionName, IDictionary<string, string> properties)
8787
if (properties.ContainsKey("compression_enabled"))
8888
{
8989
client.EnableCompression = Convert.ToBoolean(properties["compression_enabled"]);
90-
if (log.IsDebugEnabled)
91-
{
92-
log.DebugFormat("compression_enabled set to {0}", client.EnableCompression);
93-
}
90+
log.Debug("compression_enabled set to {0}", client.EnableCompression);
9491
}
9592

9693
var expirationString = GetExpirationString(properties);
9794
if (expirationString != null)
9895
{
9996
expiry = Convert.ToInt32(expirationString);
100-
if (log.IsDebugEnabled)
101-
{
102-
log.DebugFormat("using expiration of {0} seconds", expiry);
103-
}
97+
log.Debug("using expiration of {0} seconds", expiry);
10498
}
10599

106100
if (properties.ContainsKey("regionPrefix"))
107101
{
108102
regionPrefix = properties["regionPrefix"];
109103

110-
if (log.IsDebugEnabled)
111-
{
112-
log.DebugFormat("new regionPrefix :{0}", regionPrefix);
113-
}
104+
log.Debug("new regionPrefix :{0}", regionPrefix);
114105
}
115106
else
116107
{
117-
if (log.IsDebugEnabled)
118-
{
119-
log.Debug("no regionPrefix value given, using defaults");
120-
}
108+
log.Debug("no regionPrefix value given, using defaults");
121109
}
122110

123111
if (properties.ContainsKey("lingering_delete_disabled"))
124112
{
125113
noLingeringDelete = Convert.ToBoolean(properties["lingering_delete_disabled"]);
126-
if (log.IsDebugEnabled)
127-
{
128-
log.DebugFormat("lingering_delete_disabled set to {0}", noLingeringDelete);
129-
}
114+
log.Debug("lingering_delete_disabled set to {0}", noLingeringDelete);
130115
}
131116
}
132117
}
@@ -174,10 +159,7 @@ public object Get(object key)
174159
{
175160
return null;
176161
}
177-
if (log.IsDebugEnabled)
178-
{
179-
log.DebugFormat("fetching object {0} from the cache", key);
180-
}
162+
log.Debug("fetching object {0} from the cache", key);
181163
object maybeObj = client.Get(KeyAsString(key));
182164
if (maybeObj == null)
183165
{
@@ -210,18 +192,12 @@ public void Put(object key, object value)
210192
throw new ArgumentNullException("value", "null value not allowed");
211193
}
212194

213-
if (log.IsDebugEnabled)
214-
{
215-
log.DebugFormat("setting value for item {0}", key);
216-
}
195+
log.Debug("setting value for item {0}", key);
217196
bool returnOk = client.Set(KeyAsString(key), new DictionaryEntry(GetAlternateKeyHash(key), value),
218197
DateTime.Now.AddSeconds(expiry));
219198
if (!returnOk)
220199
{
221-
if (log.IsWarnEnabled)
222-
{
223-
log.WarnFormat("could not save: {0} => {1}", key, value);
224-
}
200+
log.Warn("could not save: {0} => {1}", key, value);
225201
}
226202
}
227203

@@ -232,10 +208,7 @@ public void Remove(object key)
232208
{
233209
throw new ArgumentNullException("key");
234210
}
235-
if (log.IsDebugEnabled)
236-
{
237-
log.DebugFormat("removing item {0}", key);
238-
}
211+
log.Debug("removing item {0}", key);
239212

240213
if (noLingeringDelete)
241214
client.Delete(KeyAsString(key)); // Memcached 1.4+ does not support lingering deletes anymore

0 commit comments

Comments
 (0)