diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index bf685f93..cf97df74 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true ..\Keys\Longbow.Utility.snk true @@ -14,11 +14,11 @@ - + - + diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs index b69ad17c..668c2558 100644 --- a/Bootstrap.Admin/Startup.cs +++ b/Bootstrap.Admin/Startup.cs @@ -74,7 +74,7 @@ namespace Bootstrap.Admin options.SerializerSettings.ContractResolver = new DefaultContractResolver(); options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; JsonConvert.DefaultSettings = () => options.SerializerSettings; - }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => options.Cookie.Path = "/"); services.AddApiVersioning(option => { diff --git a/Bootstrap.Client/Bootstrap.Client.csproj b/Bootstrap.Client/Bootstrap.Client.csproj index 535c0092..739ebbb5 100644 --- a/Bootstrap.Client/Bootstrap.Client.csproj +++ b/Bootstrap.Client/Bootstrap.Client.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 true ..\Keys\Longbow.Utility.snk true @@ -11,7 +11,7 @@ - + diff --git a/Bootstrap.Client/Startup.cs b/Bootstrap.Client/Startup.cs index 1e99643f..670d7cc9 100644 --- a/Bootstrap.Client/Startup.cs +++ b/Bootstrap.Client/Startup.cs @@ -56,7 +56,7 @@ namespace Bootstrap.Client options.SerializerSettings.ContractResolver = new DefaultContractResolver(); options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; JsonConvert.DefaultSettings = () => options.SerializerSettings; - }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => { options.Cookie.Path = "/"; diff --git a/Bootstrap.DataAccess.MongoDB/Bootstrap.DataAccess.MongoDB.csproj b/Bootstrap.DataAccess.MongoDB/Bootstrap.DataAccess.MongoDB.csproj index d2306fda..56a58837 100644 --- a/Bootstrap.DataAccess.MongoDB/Bootstrap.DataAccess.MongoDB.csproj +++ b/Bootstrap.DataAccess.MongoDB/Bootstrap.DataAccess.MongoDB.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netstandard2.0 true ..\Keys\Longbow.Utility.snk diff --git a/Bootstrap.DataAccess.MongoDB/MongoDbAccessManager.cs b/Bootstrap.DataAccess.MongoDB/MongoDbAccessManager.cs index cbdbd4dd..04de0224 100644 --- a/Bootstrap.DataAccess.MongoDB/MongoDbAccessManager.cs +++ b/Bootstrap.DataAccess.MongoDB/MongoDbAccessManager.cs @@ -126,11 +126,11 @@ namespace Bootstrap.DataAccess.MongoDB var connectString = DbAdapterManager.GetConnectionString("ba"); if (string.IsNullOrEmpty(connectString)) throw new InvalidOperationException("Please set the BA default value in configuration file."); - var seq = connectString.Split(";", StringSplitOptions.RemoveEmptyEntries); - if (seq.Length != 2) throw new InvalidOperationException("ConnectionString invalid in configuration file. It should be mongodb://127.0.0.1:27017;Data Source=BootstrapAdmin"); + var seq = connectString.SpanSplit(";", StringSplitOptions.RemoveEmptyEntries); + if (seq.Count != 2) throw new InvalidOperationException("ConnectionString invalid in configuration file. It should be mongodb://127.0.0.1:27017;Data Source=BootstrapAdmin"); var client = new MongoClient(seq[0]); - _db = client.GetDatabase(seq[1].Split("=", StringSplitOptions.RemoveEmptyEntries).LastOrDefault()); + _db = client.GetDatabase(seq[1].SpanSplit("=", StringSplitOptions.RemoveEmptyEntries).LastOrDefault()); } private static void InitClassMap() diff --git a/Bootstrap.DataAccess.MySQL/Bootstrap.DataAccess.MySQL.csproj b/Bootstrap.DataAccess.MySQL/Bootstrap.DataAccess.MySQL.csproj index c0dfdc0e..31fad426 100644 --- a/Bootstrap.DataAccess.MySQL/Bootstrap.DataAccess.MySQL.csproj +++ b/Bootstrap.DataAccess.MySQL/Bootstrap.DataAccess.MySQL.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netstandard2.0 true ..\Keys\Longbow.Utility.snk diff --git a/Bootstrap.DataAccess.SQLite/Bootstrap.DataAccess.SQLite.csproj b/Bootstrap.DataAccess.SQLite/Bootstrap.DataAccess.SQLite.csproj index 0a78edbd..cb44e18a 100644 --- a/Bootstrap.DataAccess.SQLite/Bootstrap.DataAccess.SQLite.csproj +++ b/Bootstrap.DataAccess.SQLite/Bootstrap.DataAccess.SQLite.csproj @@ -15,7 +15,7 @@ - + diff --git a/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj index 54c2144b..c34acfb5 100644 --- a/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj +++ b/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj @@ -15,7 +15,7 @@ - + diff --git a/BootstrapAdmin.sln b/BootstrapAdmin.sln index 349411f0..ba3a4bcf 100644 --- a/BootstrapAdmin.sln +++ b/BootstrapAdmin.sln @@ -59,8 +59,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MySQL", "MySQL", "{084E2E94 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.DataAccess.MySQL", "Bootstrap.DataAccess.MySQL\Bootstrap.DataAccess.MySQL.csproj", "{B6877AEA-EC65-47DA-BA6E-FD657729C285}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{F301A509-31AE-45EA-9453-CA8C0A73DE99}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -95,10 +93,6 @@ Global {B6877AEA-EC65-47DA-BA6E-FD657729C285}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6877AEA-EC65-47DA-BA6E-FD657729C285}.Release|Any CPU.ActiveCfg = Release|Any CPU {B6877AEA-EC65-47DA-BA6E-FD657729C285}.Release|Any CPU.Build.0 = Release|Any CPU - {F301A509-31AE-45EA-9453-CA8C0A73DE99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F301A509-31AE-45EA-9453-CA8C0A73DE99}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F301A509-31AE-45EA-9453-CA8C0A73DE99}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F301A509-31AE-45EA-9453-CA8C0A73DE99}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UnitTest/ExceptionsTest.cs b/UnitTest/ExceptionsTest.cs deleted file mode 100644 index 0ed55f11..00000000 --- a/UnitTest/ExceptionsTest.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Bootstrap.DataAccess; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace UnitTest -{ - public class ExceptionsTest - { - [Fact] - public void RetrieveExceptions_Array() - { - var config = new ConfigurationBuilder() - .SetBasePath(AppContext.BaseDirectory) - .AddInMemoryCollection(new List>() { - new KeyValuePair("DB:0:Enabled", "true"), - new KeyValuePair("DB:0:Widget", "Bootstrap.DataAccess"), - new KeyValuePair("DB:0:ConnectionStrings:ba", "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa") - }) - .Build(); - - new ServiceCollection() - .AddSingleton(config) - .AddConfigurationManager(config) - .AddDbAdapter(config); - - Exceptions excep = new Exceptions(); - var result = excep.RetrieveExceptions(); - var num = result.Count(); - - Assert.True(num >= 0); - } - - [Fact] - public void RetrieveExceptions_SQLite_Array() - { - var config = new ConfigurationBuilder() - .SetBasePath(AppContext.BaseDirectory) - .AddInMemoryCollection(new List>() { - new KeyValuePair("DB:0:Enabled", "true"), - new KeyValuePair("DB:0:Widget", "Bootstrap.DataAccess.SQLite"), - new KeyValuePair("DB:0:DBProviderFactory", "Microsoft.Data.Sqlite.SqliteFactory, Microsoft.Data.Sqlite"), - new KeyValuePair("DB:0:ConnectionStrings:ba", "Data Source=BootstrapAdmin.db;") - }) - .Build(); - - new ServiceCollection() - .AddSingleton(config) - .AddConfigurationManager(config) - .AddDbAdapter(config); - - Exceptions excep = new Exceptions(); - var result = excep.RetrieveExceptions(); - var num = result.Count(); - - Assert.True(num >= 0); - } - - [Fact] - public void RetrieveExceptions_MySQL_Array() - { - var config = new ConfigurationBuilder() - .SetBasePath(AppContext.BaseDirectory) - .AddInMemoryCollection(new List>() { - new KeyValuePair("DB:0:Enabled", "true"), - new KeyValuePair("DB:0:Widget", "Bootstrap.DataAccess.MySQL"), - new KeyValuePair("DB:0:DBProviderFactory", "MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"), - new KeyValuePair("DB:0:ConnectionStrings:ba", "Server=10.211.55.2;Database=BA;Uid=argozhang;Pwd=argo@163.com;SslMode=none;") - }) - .Build(); - - new ServiceCollection() - .AddSingleton(config) - .AddConfigurationManager(config) - .AddDbAdapter(config); - - Exceptions excep = new Exceptions(); - var result = excep.RetrieveExceptions(); - var num = result.Count(); - - Assert.True(num >= 0); - } - - [Fact] - public async void ClearExceptions_Void() - { - StaticMethods.Setup(); - Exceptions excep = new Exceptions(); - - var method = excep.GetType().GetMethod("ClearExceptions", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); - method.Invoke(excep, null); - await System.Threading.Tasks.Task.Delay(1000); - } - } -} diff --git a/UnitTest/StaticMethods.cs b/UnitTest/StaticMethods.cs deleted file mode 100644 index a2c457d5..00000000 --- a/UnitTest/StaticMethods.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using System; - -namespace UnitTest -{ - internal static class StaticMethods - { - public static void Setup() - { - var config = new ConfigurationBuilder() - .SetBasePath(AppContext.BaseDirectory) - .AddJsonFile("appsettings.json", true, true) - .AddJsonFile("appsettings.Development.json", true, true) - .Build(); - - new ServiceCollection() - .AddSingleton(config) - .AddConfigurationManager(config) - .AddDbAdapter(config); - } - } -} diff --git a/UnitTest/UnitTest.csproj b/UnitTest/UnitTest.csproj deleted file mode 100644 index 0af62409..00000000 --- a/UnitTest/UnitTest.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - netcoreapp2.1 - true - false - - - - - - - - - Always - - - Always - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - - - - - diff --git a/UnitTest/UnitTest1.cs b/UnitTest/UnitTest1.cs deleted file mode 100644 index a239d751..00000000 --- a/UnitTest/UnitTest1.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Bootstrap.Admin; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.TestHost; -using Xunit; - -namespace UnitTest -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - var server = new TestServer(WebHost.CreateDefaultBuilder() - .UseStartup()); - } - } -}