I have an Interface:
public interface ICategory
{
int Id {Get; Set};
string name {Get; Set};
ICollection<iitems> Category {Get; Set};
}
public class Category:ICategory
{
public Category()
{
IItems = new HashSet<iitems>();
1. at the migration init it says that this is an interface and it will show in db and i have to igonre it
2. IItems = new HashSet<items>(); - Pre compile error
}
public int Id {Get; Set};
public string Name {Get; Set};
public ICollection<iitems> IItems {Get; Set};
}
I must to make all the project with interface, how can make it work?
if i'm doing ICategory<item> - it kills the all idea of interface.
how i can make this work in the sql so i will not have to ignore it:
public ICollection<IItems> IItems {Get; Set};
if i'm doing this:
public ICollection<Items> Items {Get; Set};
and then
Items = new HashSet<Items>();
It doesn't have errors but still kills the interface idea.
What I have tried:
I have tried all what i wrote above + dependency injection