13
Is it possible to create one-way many-to-many association in entity framework 6 with code first and annotations? Example:
class Currency
{
public int id { get; set; }
}
class Country
{
public int id { get; set; }
// How i can annotate this property to say EF that it is many-to-many
// and it should create mapping table?
// I don't need navigation property to Country in Currency class!
public virtual IList<Currency> currencies { get; set; }
}
On Java + JPA annotations i can implement what i need this way:
@OneToMany
@JoinTable(name = "MAPPING_TABLE", joinColumns = {
@JoinColumn(name = "THIS_ID", referencedColumnName = "ID")
}, inverseJoinColumns = {
@JoinColumn(name = "OTHER_ID", referencedColumnName = "ID")
})
so, does EF have equal features?