.NET Core

The seed entity for entity type 'X' cannot be added because a non-zero value is required for property 'Id'

In Entity Framework Core, primary key properties are converted to identity columns if the database provider is SQL Server. But when we try to seed a database table with an identity column, the corresponding property value should be provided, as the migration scripts are generated by Entity Framework without connecting to the database.

Tags:  Troubleshooting

Data Annotations in EF Core

.NET provides a set of data annotation attributes that can be used to define constraints to the tables and the columns in the underlying database and override  Entity Framework Core conventions.

HTTP Error 500.34 - ASP.NET Core does not support mixing hosting models

"HTTP Error 500.34 - ASP.NET Core does not support mixing hosting models". You will get this error if you host two .NET Core web applications in the same application pool using In-process hosting. This error can be fixed using two methods. One solution is using different application pools for the web applications.  The other solution is changing the hosting model of the applications to "OutOfProcess". 

Tags:  Troubleshooting

Conventions in Entity Framework Core

Conventions are the default rules that control how a model will be mapped to a database schema. Entity Framework core follows these default rules when it is not overridden using Data Annotation Attributes and Fluent API.

Entity Framework Core Migrations

In real-world applications, data models change when new features are added to the application. The model changes have to be propagated to the database to keep the database in sync with the model. Entity Framework Core migrations enable us to incrementally update the changes in the models to the database while preserving the existing data there.

Entity Framework Core DbContext

In simple terms, DbContext is a class in Entity Framework Core that you can inherit in your application and use to access the database and do all the operations there. DbContext can manage database connections, create tables/models and manage their relationships, perform CRUD (create read, update, and delete)operations, track changes, manage transactions, provide first-level caching of objects from the data source, etc.

Installation of Entity Framework Core

Entity Framework Core is not a part of .NET Core. It is available as a Nuget Package that can be added to your project in many ways based on your development environment and the available tools. 

Introduction to Entity Framework Core (EF Core)

Entity Framework Core (EF Core) is an open-source ORM(Object Relational Mapper) framework for .NET applications. An ORM is a framework connecting objects in your application with the tables and fields in a database where the application stores data. Entity Framework Core enables .NET developers to work with a database using .NET objects. It is extensible, lightweight, and supports cross-platform development as it is a part of Microsoft’s .NET Core framework.

HTTP Error 500.30 - ASP.NET Core app failed to start

You may see an HTTP 500.30 error when your ASP.NET Core web application fails to start. This article explains how you can check the error details when you don’t have access to IIS and the web server.

Tags:  Troubleshooting

Pagination in ASP.NET Core Razor Pages using custom Tag Helper

This article explains how custom Tag Helpers can be used to develop reusable paging code for .Net Core Razor Page applications. It is highly customizable so that you can use CSS classes to modify the look and feel of the paging links and mention the number of links to be displayed at a time when there are hundreds of pages.

Tags:  Razor Page PaginationPagination

Showing 3 of 3

Search