I am creating a database using Microsoft Entity Framework and CodeFirst in C #. I want to use the database in a WPF application, so Entity classes must implement "INotifyPropertyChanged".
This can be done very elegantly using the PostSharp aspect, which automatically fires the PropertyChanged event every time a property changes. If I create such an aspect and use it on my entity classes, I get the following exception when trying to create a database:
\tSystem.Data.Entity.Edm.EdmNavigationProperty: Name: The specified name is not allowed: '<Name>k__BackingField'.
Obviously, PostSharp creates the “k__BackingField” property, which causes the creation of the database to fail because it is an invalid name in terms of EntityFramework. Is there a way around this error without manually implementing "INotifyPropertyChanged" in each individual Entity-Class?
PS: English is not my native language, I would be very grateful if you would inform me of possible errors in my messages.
Thank you in advance
source
share