Skip to content

Commit 6c62120

Browse files
authored
Update README.md
1 parent 73e371c commit 6c62120

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,22 @@ public class MyDbContextFactory : IDbContextFactory<MyDbContext>
4343
}
4444
}
4545
```
46-
3. That's all, LazyLoading enabled.
46+
3. In your model you need to declare References using the type LazyReference<T> as in the example below:
47+
```c#
48+
public class Course
49+
{
50+
private LazyReference<Department> _departmentLazy = new LazyReference<Department>();
51+
public Department Department
52+
{
53+
get
54+
{
55+
return _departmentLazy.GetValue(this, nameof(Department));
56+
}
57+
set
58+
{
59+
_departmentLazy.SetValue(value);
60+
}
61+
}
62+
}
63+
```
64+
4. That's all, LazyLoading enabled.

0 commit comments

Comments
 (0)