Open OzBob opened 1 year ago
When using Breeze, many-to-many relationships must map the join entity as a separate class. In the classic Author - Book relationship, you need to map the AuthorBook
class:
public class Book
{
public int Id { get; set; }
public ICollection<AuthorBook> AuthorBooks { get; set; }
}
public class Author
{
public int Id { get; set; }
public ICollection<AuthorBook> AuthorBooks { get; set; }
}
public class AuthorBook
{
public int BookId { get; set; }
public int AuthorId { get; set; }
public Book Book { get; set; }
public Author Author { get; set; }
}
In your example, you would need to map the PostTag
entity.
In EF, the PostTag
join entity is invisible; EF doesn’t need an explicit class, because it can infer its existence from the PostTag table, and can create new entries in the PostTag table to create new relationships.
In Breeze, the client does not have direct access to the database, so the PostTag
join entity must be represented as a separate entity.
Using EF to create a many-to-many with join table as per https://learn.microsoft.com/en-us/ef/core/modeling/relationships/many-to-many#examples
Like this,
Generates metadata as JSON:
Using the
Generates the following TS files: file name: './dictionary-2'
generate
substitute all characters for class names into a valid range? [a-zA-Z0-9]