EntityFramework.LazyLoading icon indicating copy to clipboard operation
EntityFramework.LazyLoading copied to clipboard

Use dynamic proxy objects instead of LazyReference<T>

Open darxis opened this issue 8 years ago • 0 comments

In the current version, for each Reference you need to define in your model a field of type LazyReference<T>.

Ex:

public class Course
{
   ...

    private LazyReference<Department> _departmentLazy = new LazyReference<Department>();

    public Department Department
    {
        get
        {
            return _departmentLazy.GetValue(this, nameof(Department));
        }
        set
        {
            _departmentLazy.SetValue(value);
        }
    }

    ...

}

Using dynamic Proxy objects would be better, because you don't have to define in your model such fields.

darxis avatar Mar 27 '17 21:03 darxis