Close

Profile: faheemsalik

Avatar

User posts

Bugs
5 years ago

Hi,

I am facing an error in v4.1, while I add navigation property in Customer Table using another partial class

Error is:
"Navigation property 'Addresses' on entity type 'Customer' is not virtual. UseLazyLoadingProxies requires all entity types to be public, unsealed, have virtual navigation properties, and have a public or protected constructor"



// this is the collection I added with foreign reference
protected ICollection<UserFriend> _userFriends;
public virtual ICollection<UserFriend> UserFriends
        {
            get => userFriends ?? (userFriends = new List<UserFriend>());
            protected set => _userFriends = value;
        }


I found an answer to it on google that We need to use EF Core proxies if Lazyloading is enabled in the following link
https://stackoverflow.com/questions/41881169/navigation-property-should-be-virtual-not-required-in-ef-core/41881389

Need an urgent reply/fix if possible.
Thanks