I am doing an object configuration for entity framework where object A has contains a ICollection and object B does not have any relationship to this object. How would I configure this?
Here is an example of my object setup
public class A {
public string id { get; set; }
public ICollection<B> itemsILike { get; set;}
}
public class B {
public string id { get; set; }
}
B doesn't need to know about A at all, but I want A to have a list of B that it can add or remove from (and can also be empty)
This is what I currently have, but I do not think this creates the correct relationship
public void Configure(EntityTypeBuilder<A> builder)
{
builder.HasKey(e => e.id);
builder.HasMany(e => e.itemsILike);
}
public void Configure(EntityTypeBuilder<B> builder)
{
builder.HasKey(e => e.id);
}
Any Idea as to how to configure?