We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
肖老师:您好! 最近做项目时,在使用Entity Framework Core配置好聚合根映射关系后,发现在生成表及加载数据时有很多问题,希望能听听您的意见。 场景:因为聚合根拥有一些从属值对象,并且值对象内还会有嵌套,根据官方文档,这类映射配置是没有问题的,并且从属的值对象都和聚合根对象保存到一张表里(一对一关系),映射配置如以下: buillder.ToTable("table_name"); builder.HasKey(p => p.Id); builder.Property(p => p.Name).IsRequired().HasMaxLength(20).HasColumnName("name"); builder.OwnsOne(p => p.XXX, x => { x.Porperty(p => p.aa).IsRequired().HasMaxLength(5).HasColumnName("aa"); x.OwnsOne(p => p.YYY, y => { y.Property(p => p.bb).IsRequired().HasMaxLength(20).HasColumnName("bb"); y.OwsOne(p => p.ZZZ, z => { z.Property(p => p.cc).IsRequired().HasMaxLength(50).HasColumnName("cc"); }); }); });
现在的问题是:
以上问题在网上也没查到对应的问题说明,更别说解决方案了,希望老师能予以解答说明,谢谢!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
肖老师:您好!
最近做项目时,在使用Entity Framework Core配置好聚合根映射关系后,发现在生成表及加载数据时有很多问题,希望能听听您的意见。
场景:因为聚合根拥有一些从属值对象,并且值对象内还会有嵌套,根据官方文档,这类映射配置是没有问题的,并且从属的值对象都和聚合根对象保存到一张表里(一对一关系),映射配置如以下:
buillder.ToTable("table_name");
builder.HasKey(p => p.Id);
builder.Property(p => p.Name).IsRequired().HasMaxLength(20).HasColumnName("name");
builder.OwnsOne(p => p.XXX, x => {
x.Porperty(p => p.aa).IsRequired().HasMaxLength(5).HasColumnName("aa");
x.OwnsOne(p => p.YYY, y => {
y.Property(p => p.bb).IsRequired().HasMaxLength(20).HasColumnName("bb");
y.OwsOne(p => p.ZZZ, z => {
z.Property(p => p.cc).IsRequired().HasMaxLength(50).HasColumnName("cc");
});
});
});
现在的问题是:
以上问题在网上也没查到对应的问题说明,更别说解决方案了,希望老师能予以解答说明,谢谢!
The text was updated successfully, but these errors were encountered: