public ControllerWithEntityViewModelViewModel(ControllerWithEntityScaffolderModel model) : base(model) { if (model == null) { throw new ArgumentNullException("model"); } Model = model; ServiceTypeName = model.ServiceTypeName; ViewModelTypeName = model.ViewModelTypeName; ViewModelPropertys = model.ViewModelPropertys; }
public ControllerWithEntityScaffolderViewModel(ControllerWithEntityScaffolderModel model) : base(model) { if (model == null) { throw new ArgumentNullException("model"); } this.Model = model; if (IsViewGenerationSupported) { IsViewGenerationSelected = Model.IsViewGenerationSelected; IsLayoutPageSelected = Model.IsLayoutPageSelected; IsReferenceScriptLibrariesSelected = Model.IsReferenceScriptLibrariesSelected; LayoutPageFile = model.LayoutPageFile; } ServiceTypesInternal = new ObservableCollection <ModelType>(); ServiceTypes = CollectionViewSource.GetDefaultView(ServiceTypesInternal); ServiceTypes.SortDescriptions.Add(new SortDescription("ShortTypeName", ListSortDirection.Ascending)); ViewModelTypesInternal = new ObservableCollection <ModelType>(); ViewModelTypes = CollectionViewSource.GetDefaultView(ViewModelTypesInternal); ViewModelTypes.SortDescriptions.Add(new SortDescription("ShortTypeName", ListSortDirection.Ascending)); IsViewModelSupported = model.IsViewModelSupported; IsServiceClassSupported = model.IsServiceClassSupported; if (model.IsViewModelSupported) { foreach (ModelType modelType in model.ViewModelTypes) { ViewModelTypesInternal.Add(modelType); } SetValidationMessage(model.ValidateViewModelType(null), "ViewModelType"); } if (model.IsServiceClassSupported) { foreach (ModelType modelType in model.ServiceTypes) { ServiceTypesInternal.Add(modelType); } SetValidationMessage(model.ValidateServiceType(null), "ServiceType"); } AddNewViewModelCommand = new RelayCommand(AddNewViewModel); AddNewServiceCommand = new RelayCommand(AddNewService); }