Skip to content

Commit

Permalink
Merge pull request #64 from furkandeveloper/fix/mongo_cache
Browse files Browse the repository at this point in the history
πŸ”€ Fix dependecies of Easy Cache.
  • Loading branch information
furkandeveloper authored Jan 17, 2021
2 parents 93bf10f + b0cb789 commit 2522727
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
5 changes: 3 additions & 2 deletions src/EasyProfiler.Core/EasyProfiler.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
<RepositoryUrl>https://github.com/furkandeveloper/EasyProfiler</RepositoryUrl>
<PackageTags>sql-server, profiler, query-profiler,query-analyzer</PackageTags>
<PackageReleaseNotes>
*✨ Add QueryType feature.
* βž• Add dependencies.
</PackageReleaseNotes>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoFilterer" Version="2.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/EasyProfiler.MariaDb/EasyProfiler.MariaDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
<Description>This repo, provides query profiler for EF Core.</Description>
<PackageTags>mariadb, profiler, query-profiler,query-analyzer</PackageTags>
<PackageReleaseNotes>
*✨ Add QueryType feature.
* πŸ”₯ Remove dependencies.
</PackageReleaseNotes>
<PackageIcon>easyProfilerMariaDb.png</PackageIcon>
<RepositoryUrl>https://github.com/furkandeveloper/EasyProfiler</RepositoryUrl>
<Authors>furkandeveloper</Authors>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8">
<PrivateAssets>all</PrivateAssets>
Expand Down
9 changes: 7 additions & 2 deletions src/EasyProfiler.Mongo/EasyProfiler.Mongo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
<PackageIcon>easyProfilerMongo.png</PackageIcon>
<RepositoryUrl>https://github.com/furkandeveloper/EasyProfiler</RepositoryUrl>
<PackageTags>mongoDb, profiler, query-profiler,query-analyzer, mongo</PackageTags>
<Version>1.0.1</Version>
<PackageReleaseNotes>
* πŸ”₯ Removed legacy EasyCache.
* β™» Refactored insert log scenario.
* ✨ Applyed EasyCache new version.
</PackageReleaseNotes>
<Version>1.2.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyCacheDotnetCore" Version="1.0.2" />
<PackageReference Include="EasyCache.Memory" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="MongoDB.Driver" Version="2.11.5" />
</ItemGroup>
Expand Down
20 changes: 12 additions & 8 deletions src/EasyProfiler.Mongo/Extensions/ClusterBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ο»Ώusing EasyCache.Services.Abstractions;
ο»Ώusing EasyCache.Core.Abstractions;
using EasyProfiler.Mongo.Services.Abstractions;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace EasyProfiler.Mongo.Extensions
{
Expand All @@ -26,7 +27,7 @@ public static class ClusterBuilderExtensions
/// </param>
public static void InitilazeStartedEvent(this CommandStartedEvent command, IServiceProvider serviceProvider)
{
var cacheService = serviceProvider.GetService<ICacheService>();
var cacheService = serviceProvider.GetService<IEasyCacheService>();
if (command.OperationId != null)
cacheService.Set<string>(command.OperationId + command.CommandName, command.Command.ToString(), TimeSpan.FromMinutes(5));
}
Expand All @@ -42,18 +43,21 @@ public static void InitilazeStartedEvent(this CommandStartedEvent command, IServ
/// </param>
public static void InitilazeSucceededEvent(this CommandSucceededEvent command, IServiceProvider serviceProvider)
{
var cacheService = serviceProvider.GetService<ICacheService>();
var cacheService = serviceProvider.GetService<IEasyCacheService>();
var mongoService = serviceProvider.GetService<IMongoService>();
var httpContext = serviceProvider.GetService<IHttpContextAccessor>();
var data = cacheService.Get<string>(command.OperationId + command.CommandName);
if (data != null)
{
mongoService.InsertAsync(new Models.Profiler()
Task.Run(() =>
{
Duration = command.Duration.Ticks,
Query = data.ToString(),
QueryType = command.CommandName.FindQueryType(),
RequestUrl = httpContext?.HttpContext?.Request?.Path.Value
mongoService.InsertAsync(new Models.Profiler()
{
Duration = command.Duration.Ticks,
Query = data.ToString(),
QueryType = command.CommandName.FindQueryType(),
RequestUrl = httpContext?.HttpContext?.Request?.Path.Value
});
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ο»Ώusing EasyCache.Helpers.Extensions;
ο»Ώusing EasyCache.Memory.Extensions;
using EasyProfiler.Mongo.Configuration;
using EasyProfiler.Mongo.Context;
using EasyProfiler.Mongo.Services.Abstractions;
Expand Down
5 changes: 2 additions & 3 deletions src/EasyProfiler.PostgreSQL/EasyProfiler.PostgreSQL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
<RepositoryUrl>https://github.com/furkandeveloper/EasyProfiler</RepositoryUrl>
<PackageTags>sql-server, profiler, query-profiler,query-analyzer</PackageTags>
<PackageReleaseNotes>
*✨ Add QueryType feature.
* πŸ”₯ Remove dependencies.
</PackageReleaseNotes>
<PackageIcon>easyProfilerPostgreSQL.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>furkandeveloper</Authors>
<Version>1.2.0</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
5 changes: 2 additions & 3 deletions src/EasyProfiler.SQLServer/EasyProfiler.SQLServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
<Description>This repo, provides query profiler for EF Core.</Description>
<PackageTags>sql-server, profiler, query-profiler,query-analyzer</PackageTags>
<PackageReleaseNotes>
*✨ Add QueryType feature.
*πŸ”₯ Remove dependencies.
</PackageReleaseNotes>
<PackageIcon>easyProfilerSQLServer.png</PackageIcon>
<RepositoryUrl>https://github.com/furkandeveloper/EasyProfiler</RepositoryUrl>
<Authors>furkandeveloper</Authors>
<Version>1.4.0</Version>
<Version>1.5.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 2522727

Please sign in to comment.