Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MongoDB to 3.0.0 #51

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<RootNamespace>Quartz.Spi.MongoDbJobStore</RootNamespace>
<LangVersion>9.0</LangVersion>
<LangVersion>preview</LangVersion>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<Nullable>enable</Nullable>
Expand Down
24 changes: 14 additions & 10 deletions src/Quartz.Spi.MongoDbJobStore/Quartz.Spi.MongoDbJobStore.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;net462;netstandard2.0</TargetFrameworks>
<AssemblyName>Quartz.Spi.MongoDbJobStore</AssemblyName>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1;net6.0</TargetFrameworks>
<AssemblyName>Quartz.Spi.MongoDbJobStore</AssemblyName>
<IsPackable>true</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.4.2" />
<PackageReference Include="Quartz" Version="3.0.4" />
<PackageReference Include="Common.Logging" Version="3.4.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="3.0.0"/>
<PackageReference Include="Quartz" Version="3.0.4"/>
<PackageReference Include="Common.Logging" Version="3.4.1"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="System.Data.SqlClient" Version="4.8.6"/>
<PackageReference Include="System.Net.Http" Version="4.3.4"/>
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1"/>
</ItemGroup>

</Project>
56 changes: 21 additions & 35 deletions src/Quartz.Spi.MongoDbJobStore/Util/LogicalThreadContext.cs
Original file line number Diff line number Diff line change
@@ -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

/*
Expand All @@ -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
{
Expand All @@ -50,18 +48,14 @@ public static class LogicalThreadContext
/// </summary>
/// <param name="name">The name of the item.</param>
/// <returns>The object in the call context associated with the specified name or null if no object has been stored previously</returns>

#if NET462 || NETSTANDARD2_0
static ConcurrentDictionary<string, AsyncLocal<object>> state = new ConcurrentDictionary<string, AsyncLocal<object>>();
#endif
static ConcurrentDictionary<string, AsyncLocal<object>> state =
new ConcurrentDictionary<string, AsyncLocal<object>>();

public static T GetData<T>(string name)
{
#if NET452
return (T)CallContext.GetData(name);
#elif NET462 || NETSTANDARD2_0
return state.TryGetValue(name, out AsyncLocal<object> data) ? (T)data.Value : default(T);
#endif
return state.TryGetValue(name, out AsyncLocal<object> data)
? (T)data.Value
: default(T);
}

/// <summary>
Expand All @@ -71,11 +65,7 @@ public static T GetData<T>(string name)
/// <param name="value">The object to store in the call context.</param>
public static void SetData(string name, object value)
{
#if NET452
CallContext.SetData(name, value);
#elif NET462 || NETSTANDARD2_0
state.GetOrAdd(name, _ => new AsyncLocal<object>()).Value = value;
#endif
}

/// <summary>
Expand All @@ -84,11 +74,7 @@ public static void SetData(string name, object value)
/// <param name="name">The name of the data slot to empty.</param>
public static void FreeNamedDataSlot(string name)
{
#if NET452
CallContext.FreeNamedDataSlot(name);
#elif NET462 || NETSTANDARD2_0
state.TryRemove(name, out AsyncLocal<object> discard);
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;net462;netcoreapp2.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<RootNamespace>Quartz.Spi.MongoDbJobStore.Tests</RootNamespace>
<AssemblyName>Quartz.Spi.MongoDbJobStore.Tests</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<RootNamespace>Quartz.Spi.MongoDbJobStore.Tests</RootNamespace>
<AssemblyName>Quartz.Spi.MongoDbJobStore.Tests</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="Common.Logging" Version="3.4.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.assert" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.4.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2"/>
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0"/>
<PackageReference Include="Common.Logging" Version="3.4.1"/>
<PackageReference Include="xunit" Version="2.3.1"/>
<PackageReference Include="xunit.assert" Version="2.3.1"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Quartz.Spi.MongoDbJobStore\Quartz.Spi.MongoDbJobStore.csproj"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Quartz.Spi.MongoDbJobStore\Quartz.Spi.MongoDbJobStore.csproj" />
</ItemGroup>

</Project>