Reputation: 6528
this.HasRequired(t => t.Parent)
.WithMany(t => t.Children)
.HasForeignKey(d => d.ParentId);
Here I defined a basic 1-to-many relationship. What if I do not want to have Children property exposed at all in Model, but still want to have synchronization of values between Parent and ParentId. How would I go defining such "relationship"?
Upvotes: 0
Views: 127
Reputation: 364409
You will call WithMany
without any parameter:
this.HasRequired(t => t.Parent)
.WithMany()
.HasForeignKey(d => d.ParentId);
Upvotes: 1