diff --git a/CAP.sln b/CAP.sln index e566422..8164c28 100644 --- a/CAP.sln +++ b/CAP.sln @@ -64,10 +64,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.MySql", "sampl EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.AzureServiceBus", "src\DotNetCore.CAP.AzureServiceBus\DotNetCore.CAP.AzureServiceBus.csproj", "{63B2A464-FBEA-42FB-8EFA-98AFA39FC920}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AzureServiceBus.MySql", "samples\Sample.AzureServiceBus.MySql\Sample.AzureServiceBus.MySql.csproj", "{364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.InMemoryStorage", "src\DotNetCore.CAP.InMemoryStorage\DotNetCore.CAP.InMemoryStorage.csproj", "{58B6E829-C6C8-457C-9DD0-C600650254DF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AzureServiceBus.InMemory", "samples\Sample.AzureServiceBus.InMemory\Sample.AzureServiceBus.InMemory.csproj", "{1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -134,14 +134,14 @@ Global {63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Debug|Any CPU.Build.0 = Debug|Any CPU {63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Release|Any CPU.ActiveCfg = Release|Any CPU {63B2A464-FBEA-42FB-8EFA-98AFA39FC920}.Release|Any CPU.Build.0 = Release|Any CPU - {364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {364A72B0-3AD2-4BC4-8D22-5A0484E2A08B}.Release|Any CPU.Build.0 = Release|Any CPU {58B6E829-C6C8-457C-9DD0-C600650254DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {58B6E829-C6C8-457C-9DD0-C600650254DF}.Debug|Any CPU.Build.0 = Debug|Any CPU {58B6E829-C6C8-457C-9DD0-C600650254DF}.Release|Any CPU.ActiveCfg = Release|Any CPU {58B6E829-C6C8-457C-9DD0-C600650254DF}.Release|Any CPU.Build.0 = Release|Any CPU + {1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -163,8 +163,8 @@ Global {4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F} = {3A6B6931-A123-477A-9469-8B468B5385AF} {11563D1A-27CC-45CF-8C04-C16BCC21250A} = {3A6B6931-A123-477A-9469-8B468B5385AF} {63B2A464-FBEA-42FB-8EFA-98AFA39FC920} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} - {364A72B0-3AD2-4BC4-8D22-5A0484E2A08B} = {3A6B6931-A123-477A-9469-8B468B5385AF} {58B6E829-C6C8-457C-9DD0-C600650254DF} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4} + {1E1E959C-3D0E-45C3-ABCA-DAAACE68AAB8} = {3A6B6931-A123-477A-9469-8B468B5385AF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2E70565D-94CF-40B4-BFE1-AC18D5F736AB} diff --git a/samples/Sample.AzureServiceBus.MySql/Controllers/ValuesController.cs b/samples/Sample.AzureServiceBus.InMemory/Controllers/ValuesController.cs similarity index 93% rename from samples/Sample.AzureServiceBus.MySql/Controllers/ValuesController.cs rename to samples/Sample.AzureServiceBus.InMemory/Controllers/ValuesController.cs index 6f1e2cd..74f1cdf 100644 --- a/samples/Sample.AzureServiceBus.MySql/Controllers/ValuesController.cs +++ b/samples/Sample.AzureServiceBus.InMemory/Controllers/ValuesController.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using DotNetCore.CAP; using Microsoft.AspNetCore.Mvc; -namespace Sample.AzureServiceBus.MySql.Controllers +namespace Sample.AzureServiceBus.InMemory.Controllers { [Route("api/[controller]")] public class ValuesController : Controller, ICapSubscribe diff --git a/samples/Sample.AzureServiceBus.MySql/Program.cs b/samples/Sample.AzureServiceBus.InMemory/Program.cs similarity index 90% rename from samples/Sample.AzureServiceBus.MySql/Program.cs rename to samples/Sample.AzureServiceBus.InMemory/Program.cs index 2be0f27..e2a308c 100644 --- a/samples/Sample.AzureServiceBus.MySql/Program.cs +++ b/samples/Sample.AzureServiceBus.InMemory/Program.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -namespace Sample.AzureServiceBus.MySql +namespace Sample.AzureServiceBus.InMemory { public class Program { diff --git a/samples/Sample.AzureServiceBus.MySql/Sample.AzureServiceBus.MySql.csproj b/samples/Sample.AzureServiceBus.InMemory/Sample.AzureServiceBus.InMemory.csproj similarity index 92% rename from samples/Sample.AzureServiceBus.MySql/Sample.AzureServiceBus.MySql.csproj rename to samples/Sample.AzureServiceBus.InMemory/Sample.AzureServiceBus.InMemory.csproj index 9cd6894..faa0a12 100644 --- a/samples/Sample.AzureServiceBus.MySql/Sample.AzureServiceBus.MySql.csproj +++ b/samples/Sample.AzureServiceBus.InMemory/Sample.AzureServiceBus.InMemory.csproj @@ -2,7 +2,6 @@ netcoreapp2.2 - Sample.Kafka.MySql NU1701 NU1701 diff --git a/samples/Sample.AzureServiceBus.MySql/Startup.cs b/samples/Sample.AzureServiceBus.InMemory/Startup.cs similarity index 93% rename from samples/Sample.AzureServiceBus.MySql/Startup.cs rename to samples/Sample.AzureServiceBus.InMemory/Startup.cs index f6c1db1..4da741e 100644 --- a/samples/Sample.AzureServiceBus.MySql/Startup.cs +++ b/samples/Sample.AzureServiceBus.InMemory/Startup.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; -namespace Sample.AzureServiceBus.MySql +namespace Sample.AzureServiceBus.InMemory { public class Startup { diff --git a/samples/Sample.AzureServiceBus.MySql/appsettings.json b/samples/Sample.AzureServiceBus.InMemory/appsettings.json similarity index 100% rename from samples/Sample.AzureServiceBus.MySql/appsettings.json rename to samples/Sample.AzureServiceBus.InMemory/appsettings.json diff --git a/samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj b/samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj index bec0935..4bb65ec 100644 --- a/samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj +++ b/samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj @@ -2,7 +2,6 @@ netcoreapp2.2 - Sample.Kafka.MySql NU1701 NU1701 diff --git a/src/DotNetCore.CAP.InMemoryStorage/IMonitoringApi.InMemory.cs b/src/DotNetCore.CAP.InMemoryStorage/IMonitoringApi.InMemory.cs index bb73d58..f2ef242 100644 --- a/src/DotNetCore.CAP.InMemoryStorage/IMonitoringApi.InMemory.cs +++ b/src/DotNetCore.CAP.InMemoryStorage/IMonitoringApi.InMemory.cs @@ -13,16 +13,16 @@ namespace DotNetCore.CAP.InMemoryStorage { internal class InMemoryMonitoringApi : IMonitoringApi { - private readonly InMemoryStorage _storage; + private readonly IStorage _storage; public InMemoryMonitoringApi(IStorage storage) { - _storage = storage as InMemoryStorage ?? throw new ArgumentNullException(nameof(storage)); + _storage = storage; } public StatisticsDto GetStatistics() { - var connection = (InMemoryStorageConnection)_storage.GetConnection(); + var connection = GetConnection(); var stats = new StatisticsDto { PublishedSucceeded = connection.PublishedMessages.Count(x => x.StatusName == StatusName.Succeeded), @@ -62,8 +62,7 @@ namespace DotNetCore.CAP.InMemoryStorage if (!string.IsNullOrEmpty(queryDto.Content)) { - //TODO: StartsWith will replace with regex - expression = expression.Where(x => x.Content.StartsWith(queryDto.Content)); + expression = expression.Where(x => x.Content.Contains(queryDto.Content)); } var offset = queryDto.CurrentPage * queryDto.PageSize; @@ -101,8 +100,7 @@ namespace DotNetCore.CAP.InMemoryStorage if (!string.IsNullOrEmpty(queryDto.Content)) { - //TODO: StartsWith will replace with regex - expression = expression.Where(x => x.Content.StartsWith(queryDto.Content)); + expression = expression.Where(x => x.Content.Contains(queryDto.Content)); } var offset = queryDto.CurrentPage * queryDto.PageSize;