Open Closed

does not show sql query with using AddEntityFramework() on MiniProfiler library #2165


0
ElifKaya created

Hi,

We want to integrate MiniProfiler library in ABP Framework aplication project. Actually, we can show miniprofiler view, but we can not only sql query parts. (IMAGE 1&2) I noticed that _dbContext is injected on page model class in all miniprofiler examples (IMAGE 3&4), but we are using application layer and inject app service in ABP page model class. I guess that I can not reach sql query because of this reason. (IMAGE3) I shared some images to give more detail. Can you give an advice how to solve this problem?

Thanks

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

ABP Framework version: v4.4.3 UI type: MVC DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): yes / no Exception message and stack trace: Steps to reproduce the issue:"


11 Answer(s)
  • 0
    maliming created
    Support Team

    hi

    I will create a such example.

  • 0
    maliming created
    Support Team

    https://github.com/abpframework/abp-samples/pull/107

  • 0
    ElifKaya created

    https://github.com/abpframework/abp-samples/pull/107

    Thanks for the example but adding Applicaiton and EntityFrameworkCore project references to the Web layer is the best way to solve this problem? Because when I created applicaiton template from the suite, I see that HttpApi and HttpApi.Client references as project references in the Web layer. And now, when I add the Applicaiton and EntityFrameworkCore as a project references to our current solution, the application throw an error in the runtime.

    Thanks,

  • 0
    maliming created
    Support Team

    hi

    Can you share your steps and error details?

  • 0
    ElifKaya created

    hi

    Can you share your steps and error details?

    We created application template (with tiered & tenant options) from abp suite platform 10 months ago. And project references was matching the solution in ABP suite. Actually, there is no difference between your example and mine about mini profiler configration. I can show the miniprofiler view in the UI but I can't show the sql query log in miniprofiler view.Somehow the AddEntityFramework() code doesn't work. There are some differences about project references. So I tried to add ApplicationModule and EntityFrameworkCoreModule as dependsOn to our WebModule as in your example. But all db request started to throw exception such as;

    1. Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingDbContext, Volo.Abp.AuditLogging.EntityFrameworkCore, Version=4.4.3.0
    2. An exception was thrown while activating Siemens.Docs.EntityFrameworkCore.DocsDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Siemens.Docs.EntityFrameworkCore.DocsDbContext, Siemens.Docs.EntityFrameworkCore, Version=1.8.37.0, Culture=neutral, PublicKeyToken=null]].
    3. Volo.Abp.Identity.EntityFrameworkCore.IIdentityDbContext -> Volo.Abp.Identity.EntityFrameworkCore.IdentityProDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.Abp.Identity.EntityFrameworkCore.IdentityProDbContext, Volo.Abp.Identity.Pro.EntityFrameworkCore, Version=4.4.3.0
    4. Volo.Abp.LanguageManagement.EntityFrameworkCore.LanguageManagementDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.Abp.LanguageManagement.EntityFrameworkCore.LanguageManagementDbContext, Volo.Abp.LanguageManagement.EntityFrameworkCore, Version=4.4.3.0
    5. Volo.Abp.SettingManagement.EntityFrameworkCore.SettingManagementDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.Abp.SettingManagement.EntityFrameworkCore.SettingManagementDbContext, Volo.Abp.SettingManagement.EntityFrameworkCore, Version=4.4.3.0, Culture=neutral, PublicKeyToken=null]].

    And also, DBContext classes are in the EntityFrameworkCore.DbMigrations project in our solution, but yours DBContext classes are in the EntityFrameworkCore project. I might be getting an error because of this.

  • 0
    maliming created
    Support Team

    hi

    For tiered projects, you can't see SQL in web projects. Because the web uses http to call API remotely.

    I will try to create a tiered demo.

    Maybe this will help

    https://stackoverflow.com/questions/57616987/how-to-use-miniprofiler-storage-to-support-multiple-web-instances?answertab=votes#tab-top

  • 0
    maliming created
    Support Team

    https://github.com/abpframework/abp-samples/pull/108

  • 0
    maliming created
    Support Team

  • 0
    ElifKaya created

    Thanks for your advice and example. It worked when I used it with redis on ABP Framework. But I can't see all sql queries yet. I can only see it on the login stage on the UI. For example, I tried a few other get api calls such as AuditLogs, but I could not see the sql queries. Is there any way to see all sql queries on miniprofiler view? Otherwise i will continue to follow on redis. Thanks

  • 0
    maliming created
    Support Team

    hi

    Im not sure, this is more related to https://github.com/MiniProfiler/dotnet

  • 0
    ElifKaya created

    hi

    Im not sure, this is more related to https://github.com/MiniProfiler/dotnet

    Thanks for your advice. We configured MiniProfiler library on the HttpApi.Host project, then we kept miniprofiler's data by using SqlServerStorage. So, we can show miniprofiler's data from database on the Web layer. And also, we can reach miniprofilers data as configure RouteBasePath propertirs on the HttpApi.Host project. like https://localhost:44320/profiler/results