private void AddMvcViews(Project project, string selectionRelativePath, CodeType codeType, ModelType dbContextClass, ModelMetadata efMetadata, string defaultNamespace = null) { // Get the selected code type if (string.IsNullOrEmpty(defaultNamespace)) defaultNamespace = (project.Name + ".Views"); else defaultNamespace += ".Views"; string outputFolderPath = Path.Combine(selectionRelativePath, codeType.Name + "\\Index"); // Setup the scaffolding item creation parameters to be passed into the T4 template. var parameters = new Dictionary<string, object>() { {"ModelType", codeType}, {"Namespace", defaultNamespace}, {"dbContext", dbContextClass.ShortTypeName}, {"MetadataModel", efMetadata} }; // Add the custom scaffolding item from T4 template. this.AddFileFromTemplate(project, outputFolderPath, "Views\\Views" + _viewModel.SelectedView + _viewModel.SelectedController, parameters, skipIfExists: _viewModel.SkipIfExists); }
private void AddWebApiConfig(Project project, ModelType dbContextClass, List<CodeType> ListModelType, string ModelNameSpace) { string outputFolderPath = "App_Start\\WebApiConfig"; // Setup the scaffolding item creation parameters to be passed into the T4 template. var parameters = new Dictionary<string, object>() { {"Namespace", project.Name}, {"dbContext", dbContextClass.ShortTypeName}, {"ListModelType", ListModelType}, {"ModelNameSpace", ModelNameSpace} }; // Add the custom scaffolding item from T4 template. this.AddFileFromTemplate(project, outputFolderPath, "WebApiConfig\\" + _viewModel.SelectedController, parameters, skipIfExists: _viewModel.SkipIfExists); }
private void AddBLL(Project project, string selectionRelativePath, CodeType codeType, ModelType dbContextClass, ModelMetadata efMetadata) { // Get the selected code type var defaultNamespace = (project.Name + ".BLL"); string modelTypeVariable = GetTypeVariable(codeType.Name); string BLLName = codeType.Name + "Service"; string outputFolderPath = Path.Combine(selectionRelativePath, BLLName); // Setup the scaffolding item creation parameters to be passed into the T4 template. var parameters = new Dictionary<string, object>() { {"ModelType", codeType}, {"Namespace", defaultNamespace}, {"dbContext", dbContextClass.ShortTypeName}, {"MetadataModel", efMetadata}, {"EntitySetVariable", modelTypeVariable}, {"RequiredNamespaces", new HashSet<string>(){codeType.Namespace.FullName, (project.Name + ".Models")}} }; // Add the custom scaffolding item from T4 template. this.AddFileFromTemplate(project, outputFolderPath, "BLL", parameters, skipIfExists: _viewModel.SkipIfExists); }