I've a doubt, I admit I'm a beginner in c# and software architecture. I'm working on an ASP.NET MVC4 + EF5 and I'm trying to structure my app using a three tier architecture.
In my BL I created those two viewmodels:
Word
namespace BL
{
public class WordViewModel : IWord
{
[Required, ReadOnly(true)]
public int WordId { get; set; }
public string LanguageId { get; set; }
public int VocabularyId { get; set; }
public LanguageViewModel Language { get; set; }
public VocabularyViewModel Vocabulary { get; set; }
}
}
Vocabulary
namespace BL
{
public class VocabularyViewModel : IVocabulary
{
[Required, ReadOnly(true)]
public int VocabularyId { get; set; }
public string Name { get; set; }
public List<WordViewModel> Words { get; set; }
}
}
Debugguing I noticed (and it's obvious) that there is a kind of "nested loop", I mean a Word contains a Vocabulary, that contains a list of words and each word contains a vocabulary, that contais a list of words ... and so on.
Following the tutorials, it seems to me that what I wrote is correct .. but I'm thinking at performance and memory consuming .. is it a problem? (but should be that my desing is wrong as well, I hope not)
Furthermore, but it's not a big issue, I'm using AutoMapper to map the object provided by my DAL layer (actually WordRepository and VocabularyRepository) to my viewmodel. It's easy to create nested mapping, but again, is it memory consuming?
Thank you .. I know I'm a newbie and I'm trying to do my best :)