Skip to content

Commit 0f77cbc

Browse files
author
Robin Karlsson
committed
Resolving some warnings
1 parent 58278d7 commit 0f77cbc

File tree

10 files changed

+33
-39
lines changed

10 files changed

+33
-39
lines changed

Src/NHibernate.Envers.Tests/NetSpecific/UnitTests/CustomLists/CustomListClasses.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,8 @@ public PersistentCustomBag(ISessionImplementor session, ICollection<T> coll)
9999
// We used to do this in BeforeInitialize, but CollectionChanged events were getting fired while NHibernate was loading the collection.
100100
public override bool AfterInitialize(ICollectionPersister persister)
101101
{
102-
bool result = base.AfterInitialize(persister);
102+
base.AfterInitialize(persister);
103103
throw new NotSupportedException("not yet ported to 2.0");
104-
//((INotifyCollectionChanged)InternalBag).CollectionChanged += OnCollectionChanged;
105-
//((INotifyPropertyChanged)InternalBag).PropertyChanged += OnPropertyChanged;
106-
return result;
107104
}
108105

109106
#region INotifyCollectionChanged Members

Src/NHibernate.Envers.Tests/NetSpecific/UnitTests/CustomLists/CustomListsTestModel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ public string Value
3636
set { _value = value; }
3737
}
3838

39-
public ICustomList<IAuditChild> Children
40-
{
41-
get { return _children; }
42-
}
39+
public ICustomList<IAuditChild> Children => _children;
4340

4441
private ICustomList<IAuditChild> ChildrenInternal
4542
{

Src/NHibernate.Envers.Tests/NetSpecific/UnitTests/Fluent/ConfByStringBaseTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System.Collections.Generic;
2+
using System.Linq;
23
using System.Reflection;
34
using NHibernate.Envers.Configuration.Attributes;
45
using NHibernate.Envers.Configuration.Store;
56
using NHibernate.Envers.Tests.NetSpecific.UnitTests.Fluent.Model;
67
using NHibernate.Envers.Tests.Tools;
7-
using NHibernate.Util;
88
using NUnit.Framework;
99
using SharpTestsEx;
1010

Src/NHibernate.Envers/Configuration/ClassesAuditingData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace NHibernate.Envers.Configuration
1010
/// </summary>
1111
public class ClassesAuditingData
1212
{
13-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(ClassesAuditingData));
13+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(ClassesAuditingData));
1414

1515
private readonly IDictionary<string, ClassAuditingData> entityNameToAuditingData = new Dictionary<string, ClassAuditingData>();
1616
private readonly IDictionary<PersistentClass, ClassAuditingData> persistentClassToAuditingData = new Dictionary<PersistentClass, ClassAuditingData>();
@@ -73,7 +73,7 @@ private static void forcePropertyInsertable(ClassAuditingData classAuditingData,
7373
throw new MappingException("@AuditMappedBy points to a property that doesn't exist: " +
7474
referencedEntityName + "." + propertyName);
7575
}
76-
log.DebugFormat("Non-insertable property {0}, {1} will be made insertable because a matching @AuditMappedBy was found in the {2} entity.",
76+
log.Debug("Non-insertable property {0}, {1} will be made insertable because a matching @AuditMappedBy was found in the {2} entity.",
7777
referencedEntityName, propertyName, entityName);
7878

7979
classAuditingData

Src/NHibernate.Envers/Configuration/Fluent/FluentConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace NHibernate.Envers.Configuration.Fluent
1414
/// </summary>
1515
public class FluentConfiguration : IMetaDataProvider
1616
{
17-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(FluentConfiguration));
17+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(FluentConfiguration));
1818
private readonly IList<IAttributeProvider> attributeFactories;
1919

2020
public FluentConfiguration()
@@ -162,7 +162,7 @@ private void throwIfUsingNonMappedRevisionEntity(Cfg.Configuration nhConfigurati
162162

163163
private static void addMemberMetaAndLog(System.Type type, MemberInfoAndAttribute memberInfoAndAttribute, EntityMeta entMeta)
164164
{
165-
log.DebugFormat("Adding {0} to member {1} on type {2}.",
165+
log.Debug("Adding {0} to member {1} on type {2}.",
166166
memberInfoAndAttribute.Attribute.GetType().Name,
167167
memberInfoAndAttribute.MemberInfo.Name,
168168
type.FullName);
@@ -171,7 +171,7 @@ private static void addMemberMetaAndLog(System.Type type, MemberInfoAndAttribute
171171

172172
private static void addClassMetaAndLog(System.Type type, Attribute classAttribute, EntityMeta entMeta)
173173
{
174-
log.DebugFormat("Adding {0} to type {1}.", classAttribute.GetType().Name, type.FullName);
174+
log.Debug("Adding {0} to type {1}.", classAttribute.GetType().Name, type.FullName);
175175
entMeta.AddClassMeta(classAttribute);
176176
}
177177

Src/NHibernate.Envers/Configuration/Metadata/AuditMetadataGenerator.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace NHibernate.Envers.Configuration.Metadata
1515
{
1616
public sealed class AuditMetadataGenerator
1717
{
18-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(AuditMetadataGenerator));
18+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(AuditMetadataGenerator));
1919

2020
public Cfg.Configuration Cfg { get; }
2121
public GlobalConfiguration GlobalCfg { get; }
@@ -382,9 +382,9 @@ public void GenerateFirstPass(PersistentClass pc, ClassAuditingData auditingData
382382
{
383383
// Unsupported id mapping, e.g. key-many-to-one. If the entity is used in auditing, an exception
384384
// will be thrown later on.
385-
if (log.IsDebugEnabled)
385+
if (log.IsDebugEnabled())
386386
{
387-
log.DebugFormat("Unable to create auditing id mapping for entity {0}" +
387+
log.Debug("Unable to create auditing id mapping for entity {0}" +
388388
", because of an unsupported Hibernate id mapping (e.g. key-many-to-one).", entityName);
389389
}
390390
return;
@@ -398,9 +398,9 @@ public void GenerateFirstPass(PersistentClass pc, ClassAuditingData auditingData
398398
return;
399399
}
400400

401-
if (log.IsDebugEnabled)
401+
if (log.IsDebugEnabled())
402402
{
403-
log.DebugFormat("Generating first-pass auditing mapping for entity {0}.", entityName);
403+
log.Debug("Generating first-pass auditing mapping for entity {0}.", entityName);
404404
}
405405

406406
var auditEntityName = VerEntCfg.GetAuditEntityName(entityName);
@@ -483,9 +483,9 @@ public void GenerateSecondPass(PersistentClass pc, ClassAuditingData auditingDat
483483
EntityXmlMappingData xmlMappingData)
484484
{
485485
var entityName = pc.EntityName;
486-
if (log.IsDebugEnabled)
486+
if (log.IsDebugEnabled())
487487
{
488-
log.DebugFormat("Generating second-pass auditing mapping for entity {0}.", entityName);
488+
log.Debug("Generating second-pass auditing mapping for entity {0}.", entityName);
489489
}
490490

491491
var propertyMapper = EntitiesConfigurations[entityName].PropertyMapper;

Src/NHibernate.Envers/Configuration/Metadata/CollectionMetadataGenerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace NHibernate.Envers.Configuration.Metadata
2020
{
2121
public sealed class CollectionMetadataGenerator
2222
{
23-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(CollectionMetadataGenerator));
23+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(CollectionMetadataGenerator));
2424

2525
private readonly IMetaDataStore _metaDataStore;
2626
private readonly AuditMetadataGenerator _mainGenerator;
@@ -116,7 +116,7 @@ private MiddleIdData createMiddleIdData(IdMappingData idMappingData, string pref
116116

117117
private void addOneToManyAttached(bool fakeOneToManyBidirectional)
118118
{
119-
log.DebugFormat("Adding audit mapping for property {0}. {1}" +
119+
log.Debug("Adding audit mapping for property {0}. {1}" +
120120
": one-to-many collection, using a join column on the referenced entity.", _referencingEntityName, _propertyName);
121121

122122
var mappedBy = getMappedBy(_propertyValue);
@@ -223,7 +223,7 @@ private static void addRelatedToXmlMapping(XElement xmlMapping, string prefix,
223223

224224
private void addWithMiddleTable()
225225
{
226-
log.DebugFormat("Adding audit mapping for property {0}. {1}" +
226+
log.Debug("Adding audit mapping for property {0}. {1}" +
227227
": collection with a join table.", _referencingEntityName, _propertyName);
228228

229229
// Generating the name of the middle table
@@ -253,7 +253,7 @@ private void addWithMiddleTable()
253253
}
254254
}
255255

256-
log.DebugFormat("Using join table name: {0}", auditMiddleTableName);
256+
log.Debug("Using join table name: {0}", auditMiddleTableName);
257257

258258
// Generating the XML mapping for the middle entity, only if the relation isn't inverse.
259259
// If the relation is inverse, will be later checked by comparing middleEntityXml with null.

Src/NHibernate.Envers/Configuration/Store/AuditMappedByMetaDataAdder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace NHibernate.Envers.Configuration.Store
1515
/// </summary>
1616
public class AuditMappedByMetaDataAdder : IMetaDataAdder
1717
{
18-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(AuditMappedByMetaDataAdder));
18+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(AuditMappedByMetaDataAdder));
1919
private readonly Cfg.Configuration _nhibernateConfiguration;
2020

2121
public AuditMappedByMetaDataAdder(Cfg.Configuration nhibernateConfiguration)
@@ -63,7 +63,7 @@ private void addBidirectionalInfo(IDictionary<System.Type, IEntityMeta> metas)
6363

6464
private static void addToEntityMeta(AuditMappedByAttribute attribute, EntityMeta entityMeta, MemberInfo memberInfo)
6565
{
66-
log.DebugFormat("Adding AuditMappedByAttribute [MappedBy={0}, PositionMappedBy={1}] to member {2}",
66+
log.Debug("Adding AuditMappedByAttribute [MappedBy={0}, PositionMappedBy={1}] to member {2}",
6767
attribute.MappedBy, attribute.PositionMappedBy, memberInfo);
6868
entityMeta.AddMemberMeta(memberInfo, attribute);
6969
}

Src/NHibernate.Envers/Event/AuditEventListener.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Threading;
45
using System.Threading.Tasks;
56
using NHibernate.Collection;
@@ -14,7 +15,6 @@
1415
using NHibernate.Persister.Collection;
1516
using NHibernate.Persister.Entity;
1617
using NHibernate.Proxy;
17-
using NHibernate.Util;
1818

1919
namespace NHibernate.Envers.Event
2020
{
@@ -27,7 +27,7 @@ public class AuditEventListener : IPostInsertEventListener,
2727
IPostCollectionRecreateEventListener,
2828
IInitializable
2929
{
30-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(AuditEventListener));
30+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(AuditEventListener));
3131

3232
public AuditConfiguration VerCfg { get; private set; }
3333

@@ -158,7 +158,7 @@ private static object[] postUpdateDbState(PostUpdateEvent evt)
158158
var oldState = evt.OldState;
159159
if (oldState == null)
160160
{
161-
log.InfoFormat("Using current state when persisting detached {0}. This can result in incorrect audit data if non updatable property(ies) are used.", entityPersister.EntityName);
161+
log.Info("Using current state when persisting detached {0}. This can result in incorrect audit data if non updatable property(ies) are used.", entityPersister.EntityName);
162162
return newDbState;
163163
}
164164
for (var i = 0; i < entityPersister.PropertyNames.Length; i++)

Src/NHibernate.Envers/Reader/FirstLevelCache.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace NHibernate.Envers.Reader
99
/// </summary>
1010
public class FirstLevelCache
1111
{
12-
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(FirstLevelCache));
12+
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(FirstLevelCache));
1313
private const string logAdd =
1414
"Adding entity to first level cache (Primary key: {0}, Revision: {1}, Entity name: {2})";
1515
private const string logHit =
@@ -33,35 +33,35 @@ public FirstLevelCache()
3333

3434
public void Add(string entityName, long revision, object id, object entity)
3535
{
36-
if(log.IsDebugEnabled)
37-
log.DebugFormat(logAdd, id, revision, entityName);
36+
if(log.IsDebugEnabled())
37+
log.Debug(logAdd, id, revision, entityName);
3838
cache.Add(new Tuple<string, long, object>(entityName, revision, id), entity);
3939
}
4040

4141
public bool TryGetValue(string entityName, long revision, object id, out object value)
4242
{
4343
if (cache.TryGetValue(new Tuple<string, long, object>(entityName, revision, id), out value))
4444
{
45-
if(log.IsDebugEnabled)
46-
log.DebugFormat(logHit, id, revision, entityName);
45+
if(log.IsDebugEnabled())
46+
log.Debug(logHit, id, revision, entityName);
4747
return true;
4848
}
4949
return false;
5050
}
5151

5252
public void AddEntityName(object id, long revision, object entity, string entityName)
5353
{
54-
if (log.IsDebugEnabled)
55-
log.DebugFormat(logAddEntityName, id, revision, entity.GetType().FullName, entityName);
54+
if (log.IsDebugEnabled())
55+
log.Debug(logAddEntityName, id, revision, entity.GetType().FullName, entityName);
5656
entityNameCache.Add(new Tuple<object, long, object>(id, revision, entity), entityName);
5757
}
5858

5959
public bool TryGetEntityName(object id, long revision, object entity, out string entityName)
6060
{
6161
if (entityNameCache.TryGetValue(new Tuple<object, long, object>(id, revision, entity), out entityName))
6262
{
63-
if(log.IsDebugEnabled)
64-
log.DebugFormat(logHitEntityName, id, revision, entity.GetType().FullName);
63+
if(log.IsDebugEnabled())
64+
log.Debug(logHitEntityName, id, revision, entity.GetType().FullName);
6565
return true;
6666
}
6767
return false;

0 commit comments

Comments
 (0)