entity framework - C# MVC4 EF Ninject - repository in domain class -
i have class:
question
with properties:
bool istextanswer list<string> answers
the answers question are: 2-4 answers stored in list of answers or 4 colors (stored in db, every question same). boolean decides if answers list or colors.
the colors table in database 4 rows, every color row. these colors aren't linked made new repository: colorrepository can colors.
i did in code: constructor
public question(icolorrepository colorrepository) { _colorrepository = colorrepository; }
in getter of answers try this:
if(istextanswers) return answers return _colorrepository.findall
but ninject doesn't work because it's not controller message there no parameterless constructor.
how can retrieve 4 colors database?
i need able read database, questions + answers made administrator in java program.
it looks question
entity, , entity framework needs have parameterless constructor.
your repository should separate class, domain objects should pocos , not have data access code in them.
Comments
Post a Comment