diff --git a/LiteDB.Benchmarks/LiteDB.Benchmarks.csproj b/LiteDB.Benchmarks/LiteDB.Benchmarks.csproj index 80a1ebdde..458601357 100644 --- a/LiteDB.Benchmarks/LiteDB.Benchmarks.csproj +++ b/LiteDB.Benchmarks/LiteDB.Benchmarks.csproj @@ -7,7 +7,7 @@ - + diff --git a/LiteDB.Tests/LiteDB.Tests.csproj b/LiteDB.Tests/LiteDB.Tests.csproj index a0bd2e807..728ab55a4 100644 --- a/LiteDB.Tests/LiteDB.Tests.csproj +++ b/LiteDB.Tests/LiteDB.Tests.csproj @@ -29,7 +29,7 @@ - + diff --git a/LiteDB/Client/Shared/SharedEngine.cs b/LiteDB/Client/Shared/SharedEngine.cs index c25e7d591..c18049177 100644 --- a/LiteDB/Client/Shared/SharedEngine.cs +++ b/LiteDB/Client/Shared/SharedEngine.cs @@ -3,10 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Threading; -#if NETFRAMEWORK -using System.Security.AccessControl; -using System.Security.Principal; -#endif namespace LiteDB { @@ -25,17 +21,7 @@ public SharedEngine(EngineSettings settings) try { -#if NETFRAMEWORK - var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), - MutexRights.FullControl, AccessControlType.Allow); - - var securitySettings = new MutexSecurity(); - securitySettings.AddAccessRule(allowEveryoneRule); - - _mutex = new Mutex(false, "Global\\" + name + ".Mutex", out _, securitySettings); -#else _mutex = new Mutex(false, "Global\\" + name + ".Mutex"); -#endif } catch (NotSupportedException ex) { diff --git a/LiteDB/Document/ObjectId.cs b/LiteDB/Document/ObjectId.cs index 84b0af12f..35f68c6e0 100644 --- a/LiteDB/Document/ObjectId.cs +++ b/LiteDB/Document/ObjectId.cs @@ -275,13 +275,7 @@ public override string ToString() // static constructor static ObjectId() { - _machine = (GetMachineHash() + -#if HAVE_APP_DOMAIN - AppDomain.CurrentDomain.Id -#else - 10000 // Magic number -#endif - ) & 0x00ffffff; + _machine = (GetMachineHash() + AppDomain.CurrentDomain.Id) & 0x00ffffff; _increment = (new Random()).Next(); try @@ -294,24 +288,14 @@ static ObjectId() } } - [MethodImpl(MethodImplOptions.NoInlining)] private static int GetCurrentProcessId() { -#if HAVE_PROCESS return Process.GetCurrentProcess().Id; -#else - return (new Random()).Next(0, 5000); // Any same number for this process -#endif } private static int GetMachineHash() { - var hostName = -#if HAVE_ENVIRONMENT - Environment.MachineName; // use instead of Dns.HostName so it will work offline -#else - "SOMENAME"; -#endif + var hostName = Environment.MachineName; // use instead of Dns.HostName so it will work offline return 0x00ffffff & hostName.GetHashCode(); // use first 3 bytes of hash } diff --git a/LiteDB/LiteDB.csproj b/LiteDB/LiteDB.csproj index 67eeb45f1..c4eaf1562 100644 --- a/LiteDB/LiteDB.csproj +++ b/LiteDB/LiteDB.csproj @@ -1,7 +1,7 @@  - net4.5;netstandard1.3;netstandard2.0 + netstandard2.0;netstandard2.1;net8.0;net9.0 5.0.21 5.0.21 5.0.21 @@ -30,26 +30,6 @@ true latest - - - - - TRACE;DEBUG - - - - HAVE_SHA1_MANAGED;HAVE_APP_DOMAIN;HAVE_PROCESS;HAVE_ENVIRONMENT - - - - HAVE_SHA1_MANAGED - @@ -57,18 +37,8 @@ - - - - - - - - - - - +