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>
113
113
#### Relationships
114
114
115
115
In 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 ` ) .
117
117
118
118
``` csharp
119
119
public class Person : Identifiable <int >
120
120
{
121
121
[Attr (" first-name" )]
122
122
public string FirstName { get ; set ; }
123
123
124
+ [HasMany (" todo-items" )]
124
125
public virtual List <TodoItem > TodoItems { get ; set ; }
125
126
}
126
127
```
@@ -135,6 +136,8 @@ public class TodoItem : Identifiable<int>
135
136
public string Description { get ; set ; }
136
137
137
138
public int OwnerId { get ; set ; }
139
+
140
+ [HasOne (" owner" )]
138
141
public virtual Person Owner { get ; set ; }
139
142
}
140
143
```
You can’t perform that action at this time.
0 commit comments