private void PrepareServices(MetaModel model, ApplicationModel application) { _types = new Dictionary <string, Dictionary <BaseType, List <TypeModel> > >(); _moduleTypes = new Dictionary <string, Dictionary <Module, List <TypeModel> > >(); foreach (var service in model.Services) { var serviceModel = application.AddService(service.Name); foreach (var layer in _generators.GroupBy(g => g.Layer)) { if (!_types.ContainsKey(layer.Key)) { _types[layer.Key] = new Dictionary <BaseType, List <TypeModel> >(); } if (!_moduleTypes.ContainsKey(layer.Key)) { _moduleTypes[layer.Key] = new Dictionary <Module, List <TypeModel> >(); } PrepareModule(service, serviceModel.AddLayer(layer.Key), layer.ToList()); } } }