File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -113,14 +113,15 @@ public class Person : Identifiable<int>
113113#### Relationships
114114
115115In order for navigation properties to be identified in the model,
116- they should be labeled as virtual .
116+ they should be labeled with the appropriate attribute (either ` HasOne ` or ` HasMany ` ) .
117117
118118``` csharp
119119public class Person : Identifiable <int >
120120{
121121 [Attr (" first-name" )]
122122 public string FirstName { get ; set ; }
123123
124+ [HasMany (" todo-items" )]
124125 public virtual List <TodoItem > TodoItems { get ; set ; }
125126}
126127```
@@ -135,6 +136,8 @@ public class TodoItem : Identifiable<int>
135136 public string Description { get ; set ; }
136137
137138 public int OwnerId { get ; set ; }
139+
140+ [HasOne (" owner" )]
138141 public virtual Person Owner { get ; set ; }
139142}
140143```
You can’t perform that action at this time.
0 commit comments