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
You can do this in code first quite easily in EF 6.
public class Country
{
public int ID {get;set;}
public virtual ICollection Currencys {get;set;}//don't worry about the name, pluralisation etc
}
public class Currency
{
public int ID {get;set;}
public virtual ICollection Countrys {get;set;}//same as above -
}
Compile it, run it and hey presto - magic join table in the background. Depends if the naming conventions bother you. I personally think if you are doing code first, you should do it all in the code. Some people prefer annotation, some prefer fluent API - use whichever you prefer.