Entity Framework Core Events and Diagnostic Listeners are very helpful in debugging our EF Core code. Events are called when something happens in EF Core codes. For example DbContext.SaveChangesFailed event is called when SaveChanges or SaveChangesAsync method is failed so we can use this event to find out the cause of the failure. Diagnostic listeners allow listening for any EF Core event for obtaining diagnostic information of the app. In this tutorial we are going to implement each of these 2 in our code.
Logging is an important aspect of any .NET app for debugging purpose. Through Logging we can generate SQL logs and Change Tracking information in Entity Framework Core. There are 2 types of logging in EF Core:
Entity Framework Core Change Tracker keeps track of all the loaded entities changes and these changes are applied to the database when SaveChanges method is called.
Entities are tracked on the following conditions :
Multiple users trying to update an entity data at the same time can lead to inconsistencies and data corruption. A user say Elon displays an entity data in order to update it, at this same time another user say Trump updates the same entity data before Elon saves the changes to the database. When Elon saves the data an inconsistent version is saved on the database which Elon has no knowledge. This is known as concurrency conflict.
(more…)When building database driven apps we come across scenarios that require building complex queries with multiple data sources. Common examples of such cases being Joins, Group Joins and Group by, select many and so on. Here we look into such cases and understand how to build such complex queries in Entity Framework Core.
(more…)It is necessary that we Optimize our Entity Framework Core codes so that the application remains light weight and at the same time executes faster. We can perform the optimizing techniques in EF Core by understanding which technique is best to use in a given situation. Let's discuss some of the most important ones one by one.
(more…)Owned Entity Types are those entities that can be associated with another entity only. They cannot be used separately, the other entity to which the owned entity is associated is known as it's owner. The owned enttity has a one-to-one relationship with the owner so they can be called as the dependents of the owner.
(more…)Entity Framework Core deals with object values with Value Converters and Value Comparers. The Value Converters, as the name suggest, helps in converting object values from one type to another while Value Comparers helps in comparing the object values needed for change tracking, custom comparision codes, etc.
(more…)Blazor QuickGrid component is used to display data from the database in tabular manner. Features like sorting & paging can also be added to it very easily. In this tutorial we are going to implement Blazor QuickGrid component in Blazor Web App from the very beginning. The source codes for this project is available from my GitHub repository.
(more…)If you want to replace one or more HTML elements on the DOM then use jQuery replaceWith() method.
(more…)