From d5c10afc30f88c6663f57835b6c2bac238f25514 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Tue, 12 Mar 2024 16:52:39 +1000 Subject: [PATCH] Use Array.Empty where appropriate --- .../DomainModel/Mapping/PropertyPartTester.cs | 2 +- .../FluentInterfaceTests/CustomPersister.cs | 40 +++++++++---------- .../Conventions/DefaultConventionFinder.cs | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/FluentNHibernate.Testing/DomainModel/Mapping/PropertyPartTester.cs b/src/FluentNHibernate.Testing/DomainModel/Mapping/PropertyPartTester.cs index ec001e362..f3aff732d 100644 --- a/src/FluentNHibernate.Testing/DomainModel/Mapping/PropertyPartTester.cs +++ b/src/FluentNHibernate.Testing/DomainModel/Mapping/PropertyPartTester.cs @@ -565,7 +565,7 @@ public void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplemen public SqlType[] SqlTypes { - get { return new SqlType[] {}; } + get { return Array.Empty(); } } public Type ReturnedType => null; diff --git a/src/FluentNHibernate.Testing/FluentInterfaceTests/CustomPersister.cs b/src/FluentNHibernate.Testing/FluentInterfaceTests/CustomPersister.cs index 727e26575..9553a8d88 100644 --- a/src/FluentNHibernate.Testing/FluentInterfaceTests/CustomPersister.cs +++ b/src/FluentNHibernate.Testing/FluentInterfaceTests/CustomPersister.cs @@ -34,17 +34,17 @@ public IType GetPropertyType(string propertyName) public int[] FindDirty(object[] currentState, object[] previousState, object entity, ISessionImplementor session) { - return new int[] {}; + return Array.Empty(); } public int[] FindModified(object[] old, object[] current, object entity, ISessionImplementor session) { - return new int[] {}; + return Array.Empty(); } public object[] GetNaturalIdentifierSnapshot(object id, ISessionImplementor session) { - return new object[] {}; + return Array.Empty(); } public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session) @@ -71,7 +71,7 @@ public void Update(object id, object[] fields, int[] dirtyFields, bool hasDirtyC public object[] GetDatabaseSnapshot(object id, ISessionImplementor session) { - return new object[] {}; + return Array.Empty(); } public object GetCurrentVersion(object id, ISessionImplementor session) @@ -112,7 +112,7 @@ public object CreateProxy(object id, ISessionImplementor session) public object[] GetPropertyValuesToInsert(object obj, IDictionary mergeMap, ISessionImplementor session) { - return new object[] {}; + return Array.Empty(); } public void ProcessInsertGeneratedProperties(object id, object entity, object[] state, ISessionImplementor session) @@ -149,7 +149,7 @@ public void SetPropertyValue(object obj, int i, object value, EntityMode entityM public object[] GetPropertyValues(object obj, EntityMode entityMode) { - return new object[] {}; + return Array.Empty(); } public object GetPropertyValue(object obj, int i, EntityMode entityMode) @@ -353,11 +353,11 @@ public IEntityPersister GetSubclassEntityPersister(object instance, ISessionFact public string[] PropertySpaces { - get { return new string[] {}; } + get { return Array.Empty(); } } public string[] QuerySpaces { - get { return new string[] {}; } + get { return Array.Empty(); } } public bool IsMutable => false; @@ -373,49 +373,49 @@ public string[] QuerySpaces public int[] NaturalIdentifierProperties { - get { return new int[] {}; } + get { return Array.Empty(); } } public IIdentifierGenerator IdentifierGenerator => null; public IType[] PropertyTypes { - get { return new IType[] {}; } + get { return Array.Empty(); } } public string[] PropertyNames { - get { return new string[] {}; } + get { return Array.Empty(); } } public bool[] PropertyInsertability { - get { return new bool[] {}; } + get { return Array.Empty(); } } public ValueInclusion[] PropertyInsertGenerationInclusions { - get { return new ValueInclusion[] {}; } + get { return Array.Empty(); } } public ValueInclusion[] PropertyUpdateGenerationInclusions { - get { return new ValueInclusion[] {}; } + get { return Array.Empty(); } } public bool[] PropertyCheckability { - get { return new bool[] {}; } + get { return Array.Empty(); } } public bool[] PropertyNullability { - get { return new bool[] {}; } + get { return Array.Empty(); } } public bool[] PropertyVersionability { - get { return new bool[] {}; } + get { return Array.Empty(); } } public bool[] PropertyLaziness { - get { return new bool[] {}; } + get { return Array.Empty(); } } public CascadeStyle[] PropertyCascadeStyles { - get { return new CascadeStyle[] {}; } + get { return Array.Empty(); } } public IType IdentifierType => null; @@ -457,7 +457,7 @@ public CascadeStyle[] PropertyCascadeStyles public bool[] PropertyUpdateability { - get { return new bool[] {}; } + get { return Array.Empty(); } } public bool HasCache => false; diff --git a/src/FluentNHibernate/Conventions/DefaultConventionFinder.cs b/src/FluentNHibernate/Conventions/DefaultConventionFinder.cs index 7464b5cb0..8fb5b7a49 100644 --- a/src/FluentNHibernate/Conventions/DefaultConventionFinder.cs +++ b/src/FluentNHibernate/Conventions/DefaultConventionFinder.cs @@ -150,7 +150,7 @@ private object Instantiate(Type type) if (IsFinderConstructor(constructor)) instance = constructor.Invoke(new[] { this }); else if (IsParameterlessConstructor(constructor)) - instance = constructor.Invoke(new object[] { }); + instance = constructor.Invoke(Array.Empty()); } return instance;