diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 3b9edce..25395f8 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ Quartz.Spi.MongoDbJobStore - 9.0 + preview false false enable diff --git a/src/Quartz.Spi.MongoDbJobStore/Quartz.Spi.MongoDbJobStore.csproj b/src/Quartz.Spi.MongoDbJobStore/Quartz.Spi.MongoDbJobStore.csproj index 7445a82..0d72e3e 100644 --- a/src/Quartz.Spi.MongoDbJobStore/Quartz.Spi.MongoDbJobStore.csproj +++ b/src/Quartz.Spi.MongoDbJobStore/Quartz.Spi.MongoDbJobStore.csproj @@ -1,15 +1,19 @@ - - net452;net462;netstandard2.0 - Quartz.Spi.MongoDbJobStore - true - + + net472;netstandard2.1;net6.0 + Quartz.Spi.MongoDbJobStore + true + - - - - - + + + + + + + + + diff --git a/src/Quartz.Spi.MongoDbJobStore/Util/LogicalThreadContext.cs b/src/Quartz.Spi.MongoDbJobStore/Util/LogicalThreadContext.cs index 3a6e30f..35af21f 100644 --- a/src/Quartz.Spi.MongoDbJobStore/Util/LogicalThreadContext.cs +++ b/src/Quartz.Spi.MongoDbJobStore/Util/LogicalThreadContext.cs @@ -1,20 +1,22 @@ #region License -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations + +/* + * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations * under the License. - * + * */ + #endregion /* @@ -29,11 +31,7 @@ using System.Security; // Workaround for getting off remoting removed in NET Core: http://www.cazzulino.com/callcontext-netstandard-netcore.html -#if NET452 -using System.Runtime.Remoting.Messaging; -#elif NET462 || NETSTANDARD2_0 using System.Threading; -#endif namespace Quartz.Util { @@ -50,18 +48,14 @@ public static class LogicalThreadContext /// /// The name of the item. /// The object in the call context associated with the specified name or null if no object has been stored previously - -#if NET462 || NETSTANDARD2_0 - static ConcurrentDictionary> state = new ConcurrentDictionary>(); -#endif + static ConcurrentDictionary> state = + new ConcurrentDictionary>(); public static T GetData(string name) { -#if NET452 - return (T)CallContext.GetData(name); -#elif NET462 || NETSTANDARD2_0 - return state.TryGetValue(name, out AsyncLocal data) ? (T)data.Value : default(T); -#endif + return state.TryGetValue(name, out AsyncLocal data) + ? (T)data.Value + : default(T); } /// @@ -71,11 +65,7 @@ public static T GetData(string name) /// The object to store in the call context. public static void SetData(string name, object value) { -#if NET452 - CallContext.SetData(name, value); -#elif NET462 || NETSTANDARD2_0 state.GetOrAdd(name, _ => new AsyncLocal()).Value = value; -#endif } /// @@ -84,11 +74,7 @@ public static void SetData(string name, object value) /// The name of the data slot to empty. public static void FreeNamedDataSlot(string name) { -#if NET452 - CallContext.FreeNamedDataSlot(name); -#elif NET462 || NETSTANDARD2_0 state.TryRemove(name, out AsyncLocal discard); -#endif } } } \ No newline at end of file diff --git a/tests/Quartz.Spi.MongoDbJobStore.Tests/Quartz.Spi.MongoDbJobStore.Tests.csproj b/tests/Quartz.Spi.MongoDbJobStore.Tests/Quartz.Spi.MongoDbJobStore.Tests.csproj index 1296fae..baa0db2 100644 --- a/tests/Quartz.Spi.MongoDbJobStore.Tests/Quartz.Spi.MongoDbJobStore.Tests.csproj +++ b/tests/Quartz.Spi.MongoDbJobStore.Tests/Quartz.Spi.MongoDbJobStore.Tests.csproj @@ -1,24 +1,23 @@ - - net452;net462;netcoreapp2.0 - false - Quartz.Spi.MongoDbJobStore.Tests - Quartz.Spi.MongoDbJobStore.Tests - + + net472;netstandard2.1;net6.0 + false + Quartz.Spi.MongoDbJobStore.Tests + Quartz.Spi.MongoDbJobStore.Tests + - - - - - - - - - + + + + + + + + + + + + - - - -