New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve exception message for missing dependent in table splitting #14456
Comments
Note for triage: simple repro: public class IdentityUser
{
public string Id { get; set; }
}
public class ApplicationUser : IdentityUser
{
public PersonalName Name { get; set; }
public ValidationToken ValidationToken { get; set; }
}
[Owned]
public class PersonalName
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
[Owned]
public class ValidationToken
{
public int ValidationCode { get; set; }
public DateTime ExperiationDateUTC { get; set; }
}
public class BloggingContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0");
}
public DbSet<IdentityUser> Users { get; set; }
public DbSet<ApplicationUser> AppUsers { get; set; }
}
public class Program
{
public static void Main()
{
using (var context = new BloggingContext())
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
}
}
} Stack trace:
|
Note the workaround in the answer to the original SO post. The problem only happens when the relationship is configured via attribute markup. |
I thought that the workaround was to configure the owned relations in
Note that Patient derives from AspNetUsers, and EmergencyContact is a POCO class that doesn't contain an Id property. |
Never mind... This is the error you get when you neglect to initialize the property that is a reference to the owned entity prior to adding the entity to the DB. The error message is flat-out wrong. The error message should tell me that |
Fixed in 6351aa1 |
Weird problem referencing owned types from classes that inherit from other classes. I created a simple repro. Please see https://stackoverflow.com/q/54246707/1637105
The text was updated successfully, but these errors were encountered: