.NET Core

Load Relational Data Using Include and ThenInclude in Entity Framework Core

Entity Framework Core allows you to load related entities using the navigation properties in your model. Related entities can be loaded using different ways. If you use eager loading, it will enable you to access relational data in a single database call. In eager loading, related data can be loaded using Include and ThenInclude methods.

Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate... error

When I tried to register a service that uses an object of System.Net.Http.HttpClient  for dependency injection, I got this error "Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate "

Tags:  Troubleshooting

Querying in Entity Framework Core (EF Core) - Sorting, Filtering and Grouping

 Entity Framework Core uses Language-Integrated Query (LINQ) to query the database. You can use C# or any .NET language of your choice to write LINQ queries. The queries you write in LINQ are passed to the database provider. The database provider translates it to the actual SQL, which will be executed against the database.

Server Side Pagination Using Stored Procedure and Dapper in ASP.NET Core Razor Pages

This article explains how paging can be implemented using the stored procedure in ASP.NET Core Razor Pages. When you have millions of records in the database and need high performance and complete control over the query to be used for pagination, you can use stored procedures.

Tags:  Razor Page PaginationPagination

The 'async' modifier can only be used in methods that have a body.

I declared a method in my interface using the async modifier and I am getting the error "The 'async' modifier can only be used in methods that have a body"

Tags:  Troubleshooting

Solution For Blazor Error - Cannot provide a value for property, There is no registered service of type [TypeName]

While experimenting with Blazor, I ran into "There is no registered service of type [TypeName]" error. I was trying to use a new service on a Blazor component by injecting the service into it.

Tags:  Troubleshooting

Code Snippet to Create a Checkbox List in an ASP.NET Core Razor Page Application

Checkbox lists are useful when you want to allow users to select more than one predefined option. This article explains how a Checkbox list can be generated, and the selected checkbox values can be retrieved when the page is submitted in an ASP.NET Core Razor Page application.

HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

I got the following error when I deployed my ASP.NET Core Razor page application to the production server after updating some NuGet packages to the latest version. HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

Tags:  Troubleshooting

Unable to create an object of type '[DBContextName]'. For the different patterns supported at design time see https://go.microsoft.com/fwlink/?linkid=851728

You may get the following error when you run the add-migration command in EF Core 5.  Unable to create an object of type '[DBContextName]'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728

Tags:  Troubleshooting

EF Core Migration Error: The query contains a projection '<>h_ Transparent Identifier 0 Collections in the final projection must be an 'IEnumerable<T>' type such as 'List<T>'.

The query contains a projection '<>h__TransparentIdentifier0 Collections in the final projection must be an 'IEnumerable' type such as 'List'. Consider using 'ToList' or some other mechanism to convert the 'IQueryable' or 'IOrderedEnumerable' into an 'IEnumerable'.

Tags:  Troubleshooting

Showing 1 of 3

Search