-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Report
YDB dotnet SDK version:
0.2.0
Issue
With using one-to-many relations and try to load whole object with "Include" method - drop exception:
System.MissingMethodException: 'Method not found: 'Microsoft.EntityFrameworkCore.Storage.IRelationalCommandBuilder Microsoft.EntityFrameworkCore.Storage.IRelationalCommandBuilder.Append(System.String)'.'
Tests with PostgreSQL library and EF Core 10 with the same test classes - working fine
Example code
Two relations classes:
public class YdbBlog
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<YdbPost> Posts { get; set; } = new List<YdbPost>();
}
public class YdbPost
{
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public virtual YdbBlog Blog { get; set; }
public int BlogId { get; set; }
}
YdbContext:
public class YdbDbContext : DbContext
{
public DbSet<YdbBlog> Blogs { get; set; }
public YdbDbContext()
{
Database.EnsureCreated();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<YdbPost>()
.HasOne(m => m.Blog)
.WithMany(t => t.Posts)
.HasForeignKey(m => m.Id);
modelBuilder.Entity<YdbBlog>().HasMany(t => t.Posts).WithOne(_ => _.Blog).HasForeignKey(_ => _.BlogId);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseYdb("UseTls=false;Host=localhost;Port=2136;Database=/local");
}
}
How to reproduce the error
code for inserting data:
using (var db = new YdbDbContext())
{
var blog = new YdbBlog()
{
Id = 1,
Name = "test blog"
};
blog.Posts.Add(new YdbPost { Id = 1, Title = "subject", Content = "message" });
db.Blogs.Add(blog);
db.SaveChanges();
}
code for reproduce:
using (var db = new YdbDbContext())
{
var blog = db.Blogs.Include(_ => _.Posts).First();
}
How to resolve
Return to 9.0.10 EF Core
Copilot
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working