public static SpellVM Create(SpellResource model) { Func <SpellVM> factoryMethod; if (!_factoryMethods.TryGetValue(model.GetType(), out factoryMethod)) { throw new NotSupportedException(String.Format("{0} is not supported.", model.GetType().Name)); } SpellVM viewModel = factoryMethod(); viewModel.Model = model; return(viewModel); }
private SpellVM CreateItem(SpellResource spell) => SpellViewModelFactory.Create(spell);