-
Notifications
You must be signed in to change notification settings - Fork 3.3k
EF7 Fluent API: Self Referencing Tables #1467
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The EF 7 equivalent is Cascade on delete is not supported yet |
The following are not resolving for me, I assume they are introduced in later builds of EF7 after "7.0.0-beta1", is that correct? .HasOne(x => x.Manager) |
Correct, they are currently in nightly builds. Here is some info on using the latest builds https://github.com/aspnet/EntityFramework/wiki/Getting-Started-with-Nightly-Builds. |
@rowanmiller @AndriySvyryd |
It appears as if EF7 uses all new Fluent API. Does anyone know where I might find more info? I'd like to implement self referencing tables with EF7.
public class Employee
{
public int EmployeeId //minus the gets and sets
public Employee Manager //maps to the manager's Employee
public int ManagerId //maps to the manager's Employee.EmployeeId
public string Name
public Employees
}
//EF7 Fluent API does not seem to support the following.. perhaps there is a translation?
HasOptional(x => x.Manager) //new Fluent API property maybe??
.WithMany(x => x.Employees) //new Fluent API .OneToMany
.HasForeignKey(x => x.ManagerId) //new Fluent API ForeighKey
.WillCascadeOnDelete(false); //new Fluent API property maybe??
The text was updated successfully, but these errors were encountered: