You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently lazy loading proxies will look for fields no matter what, this hinders libraries with custom properties to work (e.g. Catel ), at least can lazy loading adapt to the already existing modelBuilder.UsePropertyAccessMode method ?
=================
EF Core version: 2.1.2
Database Provider: Sqlite
Operating system: Win10 x64
IDE: Visual Studio 2017 15.8.1
The text was updated successfully, but these errors were encountered:
@bigworld12 EF writing directly to fields is currently required for lazy-loading to work. Can you show some examples of properties for which this is causing issues?
@ajcvickers
for example in Catel.Core which uses dependency-property-like properties
a typical property in the model is defined like this
// <summary>
/// Gets or sets the name.
/// </summary>
public string Name
{
get { return GetValue<string>(NameProperty); }
set { SetValue(NameProperty, value); }
}
/// <summary>
/// Register the Name property so it is known in the class.
/// </summary>
public static readonly PropertyData NameProperty = RegisterProperty("Name", typeof(string), string.Empty);
so you don't have direct access to the backing field, which adds features like (notification, saving and resetting object state, validation, etc..)
so EntityFrameworkCore will not work with these types of properties as it's only looking for fields, not the access mode defined in modelBuilder.UsePropertyAccessMode
We discussed this in triage, and decided that we can support this through #2968. Keeping this issue open to track configuration of lazy-loading with this mechanism once implemented.
ajcvickers
changed the title
Lazy Loading proxies use fields even though UsePropertyAccessMode is set to PropertyAccessMode.Property
Make lazy-loading work without direct field access
Aug 28, 2018
Currently lazy loading proxies will look for fields no matter what, this hinders libraries with custom properties to work (e.g. Catel ), at least can lazy loading adapt to the already existing
modelBuilder.UsePropertyAccessMode
method ?=================
EF Core version: 2.1.2
Database Provider: Sqlite
Operating system: Win10 x64
IDE: Visual Studio 2017 15.8.1
The text was updated successfully, but these errors were encountered: