Cannot convert from 'long?' to 'long'
I use a code similar to the following to accept the value for a query string named Id on one of my pages of a .NET Razor Page application. It is an optional query string. Its value is then passed to another function for further processing. When I compile the code, I get the error message "cannot convert from 'long?' to 'long'"
Implementation of Custom Server-Side Validation Rules in ASP.NET
We use validation attributes in ASP.NET Core to validate model properties. These validation attributes are available in System.ComponentModel.DataAnnotations namespace. Even if there are many built-in validation attributes, we will sometimes have to use custom validation attributes to enforce our business rules. This article explains how it can be done.
Your target project [ProjectName] doesn't match your migrations assembly [AssemblyName]. Either change your target project or change your migrations assembly.
I am working on a project in ASP.NET Core 5.0, which contains a web application and the related class libraries. I use Entity Framework Core for data access. My DbContext is in a class library project. When I run the add-migration command I get this error.
How to run SQL scripts in a file using EF Core migrations?
The Entity Framework code-first approach gives powerful tools to create and manage database objects like tables, fields and their constraints, etc. This article will help you if your application uses stored procedures, functions, and similar database objects and you want to create these objects in the database as part of the migrations.
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 "
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.
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"
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.