Docker Volumes are persistent data stores for containers created and managed by Docker. Volumes are stored within a directory on the host machine and not inside the container. When we mount the volume into a container, then this directory is what's mounted on the container. If an app is storing some data on files inside the container then in case of a container crash the data is bound to be lost. Volumes comes into this scenario since here we can save these files on the volumes, in case of container crash the volume is unaffected (since it is outside the container), so the files are not lost.
(more…)
Entity Framework Core (EF Core) interceptors allow interception, modification and suppression of EF Core operations. Some examples include executing a command, call to SaveChanges and so on. You can download the source code from my GitHub repository.
(more…)
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…)