Skip to content

Commit 3931d96

Browse files
authored
Remove redundant private modifiers (#670)
+semver:patch
1 parent 407387e commit 3931d96

File tree

12 files changed

+42
-41
lines changed

12 files changed

+42
-41
lines changed

src/FluentNHibernate.Testing/Utils/ExtensionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public PublicConstructor() { }
1313

1414
class PrivateConstructor
1515
{
16-
private PrivateConstructor() { }
16+
PrivateConstructor() { }
1717
}
1818

1919
class ConstructorWithArguments
2020
{
21-
private ConstructorWithArguments(int number) { }
21+
ConstructorWithArguments(int number) { }
2222
}
2323

2424
[Test]

src/FluentNHibernate/Cfg/Db/PersistenceConfiguration.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ public abstract class PersistenceConfiguration<TThisConfiguration, TConnectionSt
3737
protected const string AdoNetBatchSizeKey = NHibEnvironment.BatchSize;
3838
protected const string CurrentSessionContextClassKey = "current_session_context_class";
3939

40-
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
40+
readonly Dictionary<string, string> values = new Dictionary<string, string>();
4141

42-
private bool nextBoolSettingValue = true;
43-
private readonly TConnectionString connectionString;
44-
private readonly CacheSettingsBuilder cache = new CacheSettingsBuilder();
42+
bool nextBoolSettingValue = true;
43+
readonly TConnectionString connectionString;
44+
readonly CacheSettingsBuilder cache = new CacheSettingsBuilder();
4545

4646
protected PersistenceConfiguration()
4747
{
@@ -71,7 +71,7 @@ static IEnumerable<string> OverridenDefaults(IDictionary<string,string> settings
7171
yield return ConnectionProviderKey;
7272
}
7373

74-
private static IEnumerable<string> KeysToPreserve(NHibConfiguration nhibernateConfig, IDictionary<string, string> settings)
74+
static IEnumerable<string> KeysToPreserve(NHibConfiguration nhibernateConfig, IDictionary<string, string> settings)
7575
{
7676
var @default = new NHibConfiguration();
7777
return nhibernateConfig.Properties

src/FluentNHibernate/Mapping/AnyPart.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ namespace FluentNHibernate.Mapping;
1515
/// </summary>
1616
public class AnyPart<T> : IAnyMappingProvider
1717
{
18-
private readonly AttributeStore attributes = new AttributeStore();
19-
private readonly Type entity;
20-
private readonly Member member;
21-
private readonly IList<string> typeColumns = new List<string>();
22-
private readonly IList<string> identifierColumns = new List<string>();
23-
private readonly IList<MetaValueMapping> metaValues = new List<MetaValueMapping>();
24-
private bool nextBool = true;
18+
readonly AttributeStore attributes = new AttributeStore();
19+
readonly Type entity;
20+
readonly Member member;
21+
readonly IList<string> typeColumns = new List<string>();
22+
readonly IList<string> identifierColumns = new List<string>();
23+
readonly IList<MetaValueMapping> metaValues = new List<MetaValueMapping>();
24+
bool nextBool = true;
2525
bool idTypeSet;
2626

2727
public AnyPart(Type entity, Member member)

src/FluentNHibernate/Mapping/PropertyPart.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class PropertyPart : IPropertyMappingProvider
1515
readonly AttributeStore attributes = new AttributeStore();
1616
readonly AttributeStore columnAttributes = new AttributeStore();
1717

18-
private bool nextBool = true;
18+
bool nextBool = true;
1919

2020
public PropertyPart(Member member, Type parentType)
2121
{
@@ -201,7 +201,7 @@ public PropertyPart CustomType(Func<Type, Type> typeFunc)
201201
return CustomType(TypeMapping.GetTypeString(type));
202202
}
203203

204-
private void AddColumnsFromCompositeUserType(Type compositeUserType)
204+
void AddColumnsFromCompositeUserType(Type compositeUserType)
205205
{
206206
var inst = (ICompositeUserType)Activator.CreateInstance(compositeUserType);
207207

src/FluentNHibernate/Mapping/ReferenceComponentPart.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace FluentNHibernate.Mapping;
1212
/// <typeparam name="T">Component type</typeparam>
1313
public class ReferenceComponentPart<T>(Member property, Type containingEntityType) : IReferenceComponentMappingProvider
1414
{
15-
private string columnPrefix;
15+
string columnPrefix;
1616

1717
/// <summary>
1818
/// Sets the prefix for any columns defined within the component. To refer to the property

src/FluentNHibernate/Mapping/ToManyBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public T AsIndexedCollection<TIndex>(string indexColumn, Action<IndexPart> custo
390390
return (T)this;
391391
}
392392

393-
private void CreateIndexMapping(Action<IndexPart> customIndex)
393+
void CreateIndexMapping(Action<IndexPart> customIndex)
394394
{
395395
var indexPart = new IndexPart(typeof(T));
396396

@@ -401,7 +401,7 @@ private void CreateIndexMapping(Action<IndexPart> customIndex)
401401
#pragma warning restore 612,618
402402
}
403403

404-
private void CreateListIndexMapping(Action<ListIndexPart> customIndex)
404+
void CreateListIndexMapping(Action<ListIndexPart> customIndex)
405405
{
406406
indexMapping = new IndexMapping();
407407
var builder = new ListIndexPart(indexMapping);
@@ -737,7 +737,7 @@ protected virtual CollectionMapping GetCollectionMapping()
737737
return mapping;
738738
}
739739

740-
private string GetDefaultName()
740+
string GetDefaultName()
741741
{
742742
if (member.IsMethod)
743743
{

src/FluentNHibernate/PersistenceModel.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ public class PersistenceModel
2929
{
3030
new ComponentMapComponentReferenceResolver()
3131
};
32-
private readonly IList<IMappingModelVisitor> visitors = new List<IMappingModelVisitor>();
32+
33+
readonly IList<IMappingModelVisitor> visitors = new List<IMappingModelVisitor>();
3334
public IConventionFinder Conventions { get; }
3435
public bool MergeMappings { get; set; }
35-
private IEnumerable<HibernateMapping> compiledMappings;
36-
private ValidationVisitor validationVisitor;
36+
IEnumerable<HibernateMapping> compiledMappings;
37+
ValidationVisitor validationVisitor;
3738
public PairBiDirectionalManyToManySidesDelegate BiDirectionalManyToManyPairer { get; set; }
3839

3940
IDiagnosticMessageDispatcher diagnosticDispatcher = new DefaultDiagnosticMessageDispatcher();
@@ -86,7 +87,7 @@ public void AddMappingsFromSource(ITypeSource source)
8687
log.LoadedFluentMappingsFromSource(source);
8788
}
8889

89-
private static Assembly FindTheCallingAssembly()
90+
static Assembly FindTheCallingAssembly()
9091
{
9192
StackTrace trace = new StackTrace(false);
9293

@@ -150,7 +151,7 @@ public void Add(Type type)
150151
throw new InvalidOperationException("Unsupported mapping type '" + type.FullName + "'");
151152
}
152153

153-
private bool IsMappingOf<T>(Type type)
154+
bool IsMappingOf<T>(Type type)
154155
{
155156
return !type.IsGenericType && typeof(T).IsAssignableFrom(type);
156157
}
@@ -171,7 +172,7 @@ public virtual IEnumerable<HibernateMapping> BuildMappings()
171172
return hbms;
172173
}
173174

174-
private void BuildSeparateMappings(Action<HibernateMapping> add)
175+
void BuildSeparateMappings(Action<HibernateMapping> add)
175176
{
176177
foreach (var classMap in classProviders)
177178
{
@@ -190,7 +191,7 @@ private void BuildSeparateMappings(Action<HibernateMapping> add)
190191
}
191192
}
192193

193-
private void BuildSingleMapping(Action<HibernateMapping> add)
194+
void BuildSingleMapping(Action<HibernateMapping> add)
194195
{
195196
var hbm = new HibernateMapping();
196197

@@ -207,13 +208,13 @@ private void BuildSingleMapping(Action<HibernateMapping> add)
207208
add(hbm);
208209
}
209210

210-
private void ApplyVisitors(IEnumerable<HibernateMapping> mappings)
211+
void ApplyVisitors(IEnumerable<HibernateMapping> mappings)
211212
{
212213
foreach (var visitor in visitors)
213214
visitor.Visit(mappings);
214215
}
215216

216-
private void EnsureMappingsBuilt()
217+
void EnsureMappingsBuilt()
217218
{
218219
if (compiledMappings is not null) return;
219220

@@ -225,7 +226,7 @@ protected virtual string GetMappingFileName()
225226
return "FluentMappings.hbm.xml";
226227
}
227228

228-
private string DetermineMappingFileName(HibernateMapping mapping)
229+
string DetermineMappingFileName(HibernateMapping mapping)
229230
{
230231
if (MergeMappings)
231232
return GetMappingFileName();
@@ -246,7 +247,7 @@ public void WriteMappingsTo(TextWriter writer)
246247
WriteMappingsTo( _ => new XmlTextWriter(writer), false);
247248
}
248249

249-
private void WriteMappingsTo(Func<HibernateMapping, XmlTextWriter> writerBuilder, bool shouldDispose)
250+
void WriteMappingsTo(Func<HibernateMapping, XmlTextWriter> writerBuilder, bool shouldDispose)
250251
{
251252
EnsureMappingsBuilt();
252253

src/FluentNHibernate/SessionSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface ISessionSource
1919

2020
public class SessionSource : ISessionSource
2121
{
22-
private Dialect dialect;
22+
Dialect dialect;
2323
public Configuration Configuration { get; private set; }
2424
public ISessionFactory SessionFactory { get; private set; }
2525

src/FluentNHibernate/Testing/PersistenceSpecification.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ namespace FluentNHibernate.Testing;
99
public class PersistenceSpecification<T>
1010
{
1111
protected readonly List<Property<T>> allProperties = new List<Property<T>>();
12-
private readonly ISession currentSession;
13-
private readonly IEqualityComparer entityEqualityComparer;
14-
private readonly bool hasExistingTransaction;
12+
readonly ISession currentSession;
13+
readonly IEqualityComparer entityEqualityComparer;
14+
readonly bool hasExistingTransaction;
1515

1616
public PersistenceSpecification(ISessionSource source)
1717
: this(source.CreateSession())

src/FluentNHibernate/Testing/Values/List.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace FluentNHibernate.Testing.Values;
99
public class List<T, TListElement>(Accessor property, IEnumerable<TListElement> value)
1010
: Property<T, IEnumerable<TListElement>>(property, value)
1111
{
12-
private Action<T, Accessor, IEnumerable<TListElement>> _valueSetter;
12+
Action<T, Accessor, IEnumerable<TListElement>> _valueSetter;
1313

1414
public override Action<T, Accessor, IEnumerable<TListElement>> ValueSetter
1515
{
@@ -56,7 +56,7 @@ public override void CheckValue(object target)
5656
AssertGenericListMatches(actual, Expected);
5757
}
5858

59-
private void AssertGenericListMatches(IEnumerable actualEnumerable, IEnumerable<TListElement> expectedEnumerable)
59+
void AssertGenericListMatches(IEnumerable actualEnumerable, IEnumerable<TListElement> expectedEnumerable)
6060
{
6161
if (actualEnumerable is null)
6262
{

0 commit comments

Comments
 (0)