protected override void OnModelCreated(ControllerScaffolderModel model) { base.OnModelCreated(model); model.ControllerName = null; model.IsAsyncSupported = true; model.IsModelClassSupported = true; }
protected sealed override ControllerScaffolderModel CreateModel() { ControllerScaffolderModel model = new ControllerScaffolderModel(Context); model.ControllerName = model.GetGeneratedName(MvcProjectUtil.ControllerName, model.CodeFileExtension); OnModelCreated(model); return(model); }
public MvcDataContextViewModel(ControllerScaffolderModel model) : base(model) { if (model == null) { throw new ArgumentNullException("model"); } Model = model; DataContextName = model.DataContextName; }
protected virtual void OnModelCreated(ControllerScaffolderModel model) { model.ControllerName = null; model.IsModelClassSupported = true; model.IsDataContextSupported = false; model.IsViewFolderRequired = true; model.IsViewGenerationSupported = true; model.IsViewGenerationSelected = true; model.IsAsyncSupported = true; }
public void RecordControllerTelemetryOptions(CodeGenerationContext context, ControllerScaffolderModel model) { if (context == null) { throw new ArgumentNullException("context"); } if (model == null) { throw new ArgumentNullException("model"); } WebApiControllerScaffolderOptions webApiControllerScaffolderOption = WebApiControllerScaffolderOptions.CreatedController; if (model.IsAsyncSelected) { webApiControllerScaffolderOption |= WebApiControllerScaffolderOptions.IsAsyncSelected; } context.AddTelemetryData("WebApiControllerScaffolderOptions", (uint)webApiControllerScaffolderOption); }
public ControllerScaffolderViewModel(ControllerScaffolderModel model) : base(model) { if (model == null) { throw new ArgumentNullException("model"); } Model = model; ControllerName = model.ControllerName; IsAsyncSelected = model.IsAsyncSelected; SetValidationMessage(Model.ValidateControllerName(ControllerName), "ControllerName"); IsViewGenerationSupported = Model.IsViewGenerationSupported; if (IsViewGenerationSupported) { IsViewGenerationSelected = Model.IsViewGenerationSelected; IsLayoutPageSelected = Model.IsLayoutPageSelected; IsReferenceScriptLibrariesSelected = Model.IsReferenceScriptLibrariesSelected; LayoutPageFile = model.LayoutPageFile; } DataContextTypesInternal = new ObservableCollection <ModelType>(); ModelTypesInternal = new ObservableCollection <ModelType>(); // The CustomSort here will ensure that the <Add new> item stays at the top. Custom Sort // is mutually exclusive with the use of SortDescriptions. DataContextTypes = new ListCollectionView(DataContextTypesInternal); DataContextTypes.CustomSort = new DataContextModelTypeComparer(); ModelTypes = CollectionViewSource.GetDefaultView(ModelTypesInternal); ModelTypes.SortDescriptions.Add(new SortDescription("ShortTypeName", ListSortDirection.Ascending)); IsModelClassSupported = Model.IsModelClassSupported; IsDataContextSupported = Model.IsDataContextSupported; if (Model.IsModelClassSupported) { foreach (ModelType modelType in Model.ModelTypes) { ModelTypesInternal.Add(modelType); } SetValidationMessage(Model.ValidateModelType(null), "ModelType"); } if (Model.IsDataContextSupported) { foreach (ModelType modelType in Model.DataContextTypes) { DataContextTypesInternal.Add(modelType); } if (model.DataContextType != null) { // We have a saved datacontext selection DataContextType = Model.DataContextType; DataContextTypeName = DataContextType.DisplayName; } SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType"); } AddNewDataContextCommand = new RelayCommand(AddNewDataContext); SelectLayoutCommand = new RelayCommand(SelectLayout); AsyncInformationIcon = GetInformationIcon(); }
protected override object CreateViewModel(ControllerScaffolderModel model) { throw new NotImplementedException(); }
protected virtual void OnModelCreated(ControllerScaffolderModel model) { // intentionally empty }
protected override object CreateViewModel(ControllerScaffolderModel model) { return(new ControllerScaffolderViewModel(model)); }
protected override void OnModelCreated(ControllerScaffolderModel model) { base.OnModelCreated(model); model.IsViewFolderRequired = true; }
public void RecordControllerTelemetryOptions(CodeGenerationContext context, ControllerScaffolderModel model) { }
public ControllerScaffolderViewModel(ControllerScaffolderModel model) : base(model) { if (model == null) { throw new ArgumentNullException("model"); } Model = model; ControllerName = model.ControllerName; IsAsyncSelected = model.IsAsyncSelected; SetValidationMessage(Model.ValidateControllerName(ControllerName), "ControllerName"); IsViewGenerationSupported = Model.IsViewGenerationSupported; if (IsViewGenerationSupported) { IsViewGenerationSelected = Model.IsViewGenerationSelected; IsLayoutPageSelected = Model.IsLayoutPageSelected; IsReferenceScriptLibrariesSelected = Model.IsReferenceScriptLibrariesSelected; LayoutPageFile = model.LayoutPageFile; } DataContextTypesInternal = new ObservableCollection<ModelType>(); ModelTypesInternal = new ObservableCollection<ModelType>(); // The CustomSort here will ensure that the <Add new> item stays at the top. Custom Sort // is mutually exclusive with the use of SortDescriptions. DataContextTypes = new ListCollectionView(DataContextTypesInternal); DataContextTypes.CustomSort = new DataContextModelTypeComparer(); ModelTypes = CollectionViewSource.GetDefaultView(ModelTypesInternal); ModelTypes.SortDescriptions.Add(new SortDescription("ShortTypeName", ListSortDirection.Ascending)); IsModelClassSupported = Model.IsModelClassSupported; IsDataContextSupported = Model.IsDataContextSupported; if (Model.IsModelClassSupported) { foreach (ModelType modelType in Model.ModelTypes) { ModelTypesInternal.Add(modelType); } SetValidationMessage(Model.ValidateModelType(null), "ModelType"); } if (Model.IsDataContextSupported) { foreach (ModelType modelType in Model.DataContextTypes) { DataContextTypesInternal.Add(modelType); } if (model.DataContextType != null) { // We have a saved datacontext selection DataContextType = Model.DataContextType; DataContextTypeName = DataContextType.DisplayName; } SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType"); } AddNewDataContextCommand = new RelayCommand(AddNewDataContext); SelectLayoutCommand = new RelayCommand(SelectLayout); AsyncInformationIcon = GetInformationIcon(); }