Answer the question
In order to leave comments, you need to log in
How to make a one-to-one relationship in migration?
How can one-to-one connectivity be made in migration?
I'm trying to do it with ForeignKey:
public class SettingModel
{
[Key]
[ForeignKey("ApplicationUser")]
public int Id { get; set; }
public string Sound { get; set; }
public ApplicationUser User { get; set; }
}
public class SettingModelContext : DbContext
{
public DbSet<SettingModel> Phones { get; set; }
public SettingModelContext() : base("SettingModelContextConnection")
{ }
}
Недопустимый атрибут ForeignKeyAttribute в свойстве "Id" в типе "ExampleCustomUserAndRole.Models.SettingModel". Имя свойства навигации "ApplicationUser" не найдено в зависимом типе "ExampleCustomUserAndRole.Models.SettingModel". Значение Name должно быть допустимым именем свойства навигации.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question