Base solution for your next web application
Open Closed

.NET Zero Enquiries #11160


User avatar
0
alramz created

Prerequisites

  • What is your product version? v11.2.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET Framework 4.6.1 (upgraded to 4.8)

We have 2 questions: 1 - How can we access database context within pages (.cshtml), and also a console application?

2 - We have found several lines of code incorrectly using Linq, and so raise exceptions, at the following locations: .Application\Auditing\AuditLogAppService.cs - Line 50 .Application\LocalizationLanguageAppService.cs - Line 167 .Application\Organizations\OrganizationUnitAppService.cs - Line 64 .Application\MultiTenancy\TenantAppService.cs - Line 38 .Application\AuthorizationUserAppService.cs - Line 99 .Application\Authorization\UserLinkAppService.cs - Line 136


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    1. You can use IDbContextProvider but we don't suggest accessing the DbContext from the cshtml page. Instead, it is better to get the data in the Controller and pass it to your cshtml page.
    2. We don't see any issue on those app services. Could you share a sample LINQ query you are having problem with ? Please also share the steps to reproduce thhe problem.

    Thanks,