This question is locked. New answers and comments are not allowed.
Hi all!
I have a Measure class and a Result. I have a relationship "A Measure can have many Result", and a navigation property IList<Result> Results in my Measure class.
Now, to make my development easier, i wan't to have a property IDictionary<MyEnum, Result> ResultDictionary to use instead of Results. So I would not use Results at all from ouside, and use a method AddResult that would be like
My question is, is there a better way to achieve this? (I'm using the visual designer)
If not, is it possible to change the accessibility of the navigatinal property Results, to set it as private, so I make sure that I don't add an item to it without updating my dictionary?
And last question, I want to initialize my dictionary when my IList<Result> is loaded from the DB, how to do so?
I have a Measure class and a Result. I have a relationship "A Measure can have many Result", and a navigation property IList<Result> Results in my Measure class.
Now, to make my development easier, i wan't to have a property IDictionary<MyEnum, Result> ResultDictionary to use instead of Results. So I would not use Results at all from ouside, and use a method AddResult that would be like
public
void
AddResult(Result result)
{
//to keep ma data persistent:
this
.Results.Add(result);
//to keep my dictionary up to date:
this
.ResultDictionary .Add(result.Key, result);
}
If not, is it possible to change the accessibility of the navigatinal property Results, to set it as private, so I make sure that I don't add an item to it without updating my dictionary?
And last question, I want to initialize my dictionary when my IList<Result> is loaded from the DB, how to do so?