diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..b536fe8
Binary files /dev/null and b/.DS_Store differ
diff --git a/.idea/.idea.Loki/.idea/contentModel.xml b/.idea/.idea.Loki/.idea/contentModel.xml
new file mode 100644
index 0000000..8d9a5c1
--- /dev/null
+++ b/.idea/.idea.Loki/.idea/contentModel.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Loki/.idea/indexLayout.xml b/.idea/.idea.Loki/.idea/indexLayout.xml
new file mode 100644
index 0000000..f1feadf
--- /dev/null
+++ b/.idea/.idea.Loki/.idea/indexLayout.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Loki/.idea/modules.xml b/.idea/.idea.Loki/.idea/modules.xml
new file mode 100644
index 0000000..690176f
--- /dev/null
+++ b/.idea/.idea.Loki/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Loki/.idea/vcs.xml b/.idea/.idea.Loki/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/.idea.Loki/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Loki/.idea/workspace.xml b/.idea/.idea.Loki/.idea/workspace.xml
new file mode 100644
index 0000000..a225508
--- /dev/null
+++ b/.idea/.idea.Loki/.idea/workspace.xml
@@ -0,0 +1,704 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Loki/riderModule.iml b/.idea/.idea.Loki/riderModule.iml
new file mode 100644
index 0000000..f7e3ce3
--- /dev/null
+++ b/.idea/.idea.Loki/riderModule.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Loki.MSSQL/Loki.MSSQL.csproj b/Loki.MSSQL/Loki.MSSQL.csproj
index 09b4df7..49a17c6 100644
--- a/Loki.MSSQL/Loki.MSSQL.csproj
+++ b/Loki.MSSQL/Loki.MSSQL.csproj
@@ -1,65 +1,11 @@
-
-
-
+
- Debug
- AnyCPU
- {8F4D5AF6-2740-4246-A03C-660983AEC2A2}
- Library
- Properties
- Loki.MSSQL
- Loki.MSSQL
- v4.6.1
- 512
+ netstandard2.0
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {0483E6C7-3D76-41A3-BE26-AA951BFB0400}
- Loki
-
+
-
+
-
-
\ No newline at end of file
diff --git a/Loki.MSSQL/Properties/AssemblyInfo.cs b/Loki.MSSQL/Properties/AssemblyInfo.cs
deleted file mode 100644
index 3f2fe6b..0000000
--- a/Loki.MSSQL/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Loki.MSSQL")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Loki.MSSQL")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("8f4d5af6-2740-4246-a03c-660983aec2a2")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Loki.Tests/Loki.Tests.csproj b/Loki.Tests/Loki.Tests.csproj
index 995ccb6..d8cec4e 100644
--- a/Loki.Tests/Loki.Tests.csproj
+++ b/Loki.Tests/Loki.Tests.csproj
@@ -1,104 +1,21 @@
-
-
+
- Debug
- AnyCPU
- {E403E1C7-03E1-4BBB-9CF3-9B6BBF01626B}
- Library
- Properties
- Loki.Tests
- Loki.Tests
- v4.6.1
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
+ netstandard2.0;net461
-
- ..\packages\AutoFixture.3.50.2\lib\net40\Ploeh.AutoFixture.dll
- True
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
- {8f4d5af6-2740-4246-a03c-660983aec2a2}
- Loki.MSSQL
-
-
- {0483e6c7-3d76-41a3-be26-aa951bfb0400}
- Loki
-
+
+
-
-
+
+
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Loki.Tests/Properties/AssemblyInfo.cs b/Loki.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index d39daba..0000000
--- a/Loki.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Loki.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Loki.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("e403e1c7-03e1-4bbb-9cf3-9b6bbf01626b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Loki.Tests/SimpleTest.cs b/Loki.Tests/SimpleTest.cs
index bb9c141..537f229 100644
--- a/Loki.Tests/SimpleTest.cs
+++ b/Loki.Tests/SimpleTest.cs
@@ -1,12 +1,18 @@
using System.Collections.Generic;
-using System.Configuration;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
+using AutoFixture;
using Loki.MSSQL;
using Loki.Redis;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Ploeh.AutoFixture;
+#if NET461
+using System.Configuration;
+#endif
+#if NETSTANDARD2_0
+using Microsoft.Extensions.Configuration;
+
+#endif
namespace Loki.Tests
{
@@ -32,12 +38,23 @@ public void Initialize()
new DnsEndPoint("your redis endpoint", 6379)
};
- string connectionString = ConfigurationManager.ConnectionStrings["TestDb"].ConnectionString;
+ string connectionString = "";
+
+#if NET461
+ connectionString = ConfigurationManager.ConnectionStrings["TestDb"].ConnectionString;
+#endif
+
+#if NETSTANDARD2_0
+ var config = new ConfigurationBuilder()
+ .AddJsonFile("appconfig.json")
+ .Build();
+ connectionString = config["TestDb"];
+#endif
LokiConfigurationBuilder.Instance.SetServiceKey("SimpleTestClient")
- .SetPrimaryLockHandler(new RedisLokiLockHandler(redisEndPoints.ToArray()))
- .SetSecondaryLockHandler(new MSSQLLokiLockHandler(connectionString))
- .Build();
+ .SetPrimaryLockHandler(new RedisLokiLockHandler(redisEndPoints.ToArray()))
+ .SetSecondaryLockHandler(new MSSQLLokiLockHandler(connectionString))
+ .Build();
}
[TestMethod]
@@ -64,7 +81,6 @@ public void TestClientLocking_WhenUseSharedResource_ShouldHaveNotUseSameItem()
};
-
//Act
clientTasks.ForEach(x => x.Start());
@@ -72,9 +88,9 @@ public void TestClientLocking_WhenUseSharedResource_ShouldHaveNotUseSameItem()
//Assert
var dublicateItems = Source.ProcessedItems
- .GroupBy(i => i)
- .Where(g => g.Count() > 1)
- .Select(g => g.Key).ToList();
+ .GroupBy(i => i)
+ .Where(g => g.Count() > 1)
+ .Select(g => g.Key).ToList();
Assert.AreEqual(0, dublicateItems.Count);
}
diff --git a/Loki.Tests/appconfig.json b/Loki.Tests/appconfig.json
new file mode 100644
index 0000000..3d43eb3
--- /dev/null
+++ b/Loki.Tests/appconfig.json
@@ -0,0 +1,3 @@
+{
+ "TestDb": "Server=.;Database=TestDb;Integrated Security=true;"
+}
\ No newline at end of file
diff --git a/Loki/Loki.csproj b/Loki/Loki.csproj
index 05a3c75..433dd7d 100644
--- a/Loki/Loki.csproj
+++ b/Loki/Loki.csproj
@@ -1,73 +1,9 @@
-
-
-
-
- Debug
- AnyCPU
- {0483E6C7-3D76-41A3-BE26-AA951BFB0400}
- Library
- Properties
- Loki
- Loki
- v4.6.1
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\StackExchange.Redis.1.2.0\lib\net46\StackExchange.Redis.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ netstandard2.0
+
+
+
+
+
\ No newline at end of file
diff --git a/Loki/Properties/AssemblyInfo.cs b/Loki/Properties/AssemblyInfo.cs
deleted file mode 100644
index ed9eed0..0000000
--- a/Loki/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Loki")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Loki")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("0483e6c7-3d76-41a3-be26-aa951bfb0400")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]