Tuesday, April 30, 2019

EF Core: Reference Documents from multiple Tables

I have a web application where documents can be attached to different forms. The classes would look for example like this

public class Application { public ICollection<Document> Documents { get; set; } public ICollection<Document> Photos { get; set; } } public class Review { public ICollection<Document> Documents { get; set; } } 

I would like to have a simple mapping. Every document can only get referenced once.

What would be the best way to configure EF Core with fluent configuration? When I don't configure anything I get one column per reference on my Document Table, which seems not necessary for my use case.

Would be great if someone can give me useful hint on how to achieve this.

EF Core: Reference Documents from multiple Tables Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team