public InvoiceController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo, IFeeScheduleDtlService ifsdrepo, IInvoiceService iinvsrepo) : base(strepo, ctrepo, adrepo, ifrepo) { _ifsdrepo = ifsdrepo; _iinvsrepo = iinvsrepo; }
public SessionTermController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo, ISessionService issrepo, SessionDTLService isdrepo) : base(strepo, ctrepo, adrepo, ifrepo) { _issrepo = issrepo; _isdrepo = isdrepo; }
public BaseApiController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo) { _strepo = strepo; _ctrepo = ctrepo; _adrepo = adrepo; _ifrepo = ifrepo; }
/// <summary> /// 生成代码 /// </summary> /// <param name="project">项目信息</param> /// <param name="selectionRelativePath"></param> /// <param name="codeGeneratorViewModel"></param> private void GenerateCode(Project project, string selectionRelativePath, WebFormsCodeGeneratorViewModel codeGeneratorViewModel) { // Get Model Type var modelType = codeGeneratorViewModel.ModelType.CodeType; // Ensure the Data Context string dbContextTypeName = codeGeneratorViewModel.DbContextModelType.TypeName; IEntityFrameworkService efService = Context.ServiceProvider.GetService <IEntityFrameworkService>(); ModelMetadata efMetadata = efService.AddRequiredEntity(Context, dbContextTypeName, modelType.FullName); // Get the dbContext ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); // Get the dbContext namespace string dbContextNamespace = dbContext.Namespace != null ? dbContext.Namespace.FullName : String.Empty; // Ensure the Dynamic Data Field templates EnsureDynamicDataFieldTemplates(project, dbContextNamespace, dbContextTypeName); // Add Web Forms Pages from Templates AddWebFormsPages( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, efMetadata, codeGeneratorViewModel.UseMasterPage, codeGeneratorViewModel.DesktopMasterPage, codeGeneratorViewModel.DesktopPlaceholderId, codeGeneratorViewModel.OverwriteViews ); }
public InventoryController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo, IInventoryService irepo, ILedgerCOAService ilcrepo) : base(strepo, ctrepo, adrepo, ifrepo) { _irepo = irepo; _ilcrepo = ilcrepo; }
// Setting Columns : display name, allow null private bool?ShowColumnSetting() { var modelType = _codeGeneratorViewModel.ModelType.CodeType; string savefolderPath = Path.Combine(Context.ActiveProject.GetFullPath(), "CodeGen"); StorageMan <MetaTableInfo> sm = new StorageMan <MetaTableInfo>(modelType.Name, savefolderPath); MetaTableInfo data = sm.Read(); if (data.Columns.Any()) { _ModelMetadataVM = new ModelMetadataViewModel(data); } else { string dbContextTypeName = _codeGeneratorViewModel.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(Context.ActiveProject, dbContextTypeName); IEntityFrameworkService efService = Context.ServiceProvider.GetService <IEntityFrameworkService>(); ModelMetadata efMetadata = efService.AddRequiredEntity(Context, dbContextTypeName, modelType.FullName); _ModelMetadataVM = new ModelMetadataViewModel(efMetadata); } ModelMetadataDialog dialog = new ModelMetadataDialog(_ModelMetadataVM); bool?isOk = dialog.ShowModal(); if (isOk == true) { sm.Save(_ModelMetadataVM.DataModel); } return(isOk); }
public static CodeTypeModel[] GetCodeTypeModels(Project project, ICodeTypeService codeTypeService, IReflectedTypesService reflectedTypesService) { var types = codeTypeService.GetAllCodeTypes(project).ToArray(); var models = types.Select(t => ModelUtils.GetCodeTypeModel(t, reflectedTypesService)).ToArray(); return(models); }
/// <summary> /// Constructor /// </summary> /// <param name="context">The code generation context</param> public CustomViewModel(CodeGenerationContext context) { Context = context; ICodeTypeService codeTypeService = (ICodeTypeService)Context.ServiceProvider.GetService(typeof(ICodeTypeService)); this.ModelTypes = codeTypeService.GetAllCodeTypes(Context.ActiveProject) //.Where(codeType => codeType.IsValidWebProjectEntityType()) .Where(codeType => codeType.IsDerivedType("System.Web.Http.ApiController")) .Select(codeType => new ModelType(codeType)); }
private void CreateViewModelFromMethodParameters() { ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); Project project = _context.ActiveProject; CodeType dbContext = codeTypeService.GetCodeType(project, DbContextModelType.TypeName); foreach (CodeElement code in dbContext.Members) { if (code.Name == this.MethodTypeName) { //讀取參數 CodeFunction myMethod = (CodeFunction)code; MetaTableInfo data1 = new StorageMan <MetaTableInfo>(myMethod.Name, SaveFolderPath).Read(); if (data1.Columns.Any()) { this.QueryFormViewModel = new MetadataSettingViewModel(data1); } else { this.QueryFormViewModel = new MetadataSettingViewModel(myMethod); } // 讀取回傳型別 CodeTypeRef returnTypeRef = myMethod.Type; string enumType = returnTypeRef.AsFullName; int idx1 = enumType.IndexOf("<"); int idx2 = enumType.LastIndexOf(">"); string baseType = enumType.Substring(idx1 + 1, idx2 - idx1 - 1); CodeType returnContextType = codeTypeService.GetCodeType(project, baseType); ModelType = new ModelType(returnContextType); MetaTableInfo data2 = new StorageMan <MetaTableInfo>(ModelType.ShortName, SaveFolderPath).Read(); if (data2.Columns.Any()) { this.ResultListViewModel = new MetadataSettingViewModel(data2); } else { //IEntityFrameworkService efService = _context.ServiceProvider.GetService<IEntityFrameworkService>(); //Microsoft.AspNet.Scaffolding.Core.Metadata.ModelMetadata efMetadata // = efService.AddRequiredEntity(_context, DbContextModelType.TypeName, ModelType.CodeType.FullName); //this.ResultListViewModel = new MetadataSettingViewModel(efMetadata); //TODO partal class 會找不到成員 this.ResultListViewModel = new MetadataSettingViewModel(returnContextType); } } } }
private void GetStoreProcedureFunction_TESTCODE() { string dbContextTypeName = this.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); Project project = _context.ActiveProject; CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); IEntityFrameworkService efService = _context.ServiceProvider.GetService <IEntityFrameworkService>(); //ModelMetadata efMetadata = efService.AddRequiredEntity(_context, dbContextTypeName, ""); //GetMethodInfo(string.Format("{0}, {1}", dbContextTypeName, project.Name)); foreach (CodeElement code in dbContext.Members) { if (code.Kind == vsCMElement.vsCMElementFunction) { //if (code.Name != "QueryBooks") // continue; CodeFunction myMethod = (CodeFunction)code; //讀取參數 foreach (CodeElement p in myMethod.Parameters) { CodeParameter p1 = (CodeParameter)p; string pName = p1.Name; string pType = p1.Type.AsString; } CodeTypeRef returnTypeRef = myMethod.Type; string enumType = returnTypeRef.AsFullName; int idx1 = enumType.IndexOf("<"); int idx2 = enumType.LastIndexOf(">"); string baseType = enumType.Substring(idx1 + 1, idx2 - idx1 - 1); CodeType returnModel = codeTypeService.GetCodeType(project, baseType); // 讀取回傳型別 foreach (CodeElement cc in returnModel.Members) { if (cc.Kind == vsCMElement.vsCMElementProperty) { CodeProperty p2 = (CodeProperty)cc; string pName = p2.Name; string pType = p2.Type.AsString; } } } } }
private ModelType getItemClass() { if (ModelType == null) { return(null); } ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); Project project = _context.ActiveProject; var cls = codeTypeService .GetAllCodeTypes(project) .Where(IsItemClass) .Select(codeType => new ModelType(codeType)) .FirstOrDefault(); return(cls); }
private void GetStoreProcedureFunctions() { string dbContextTypeName = this.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); Project project = _context.ActiveProject; CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); _methodTypeCollection = new ObservableCollection <MethodType>(); foreach (CodeElement code in dbContext.Members) { if (code.Kind == vsCMElement.vsCMElementFunction) { CodeFunction fun = (CodeFunction)code; //if( fun.Type != null) _methodTypeCollection.Add(new MethodType(fun)); } } OnPropertyChanged("MethodTypeCollection"); }
private string GetUniqueCodeBesideName(Project project, string originalName) { if (originalName == "Default" && ProjectLanguage.VisualBasic.Equals(Context.ActiveProject.GetCodeLanguage())) { originalName = "_Default"; } var counter = 0; var currentName = originalName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); while (codeTypeService.GetAllCodeTypes(project).Any(c => c.Name == currentName)) { counter++; currentName = originalName + counter.ToString(); } return(currentName); }
/// <summary> /// This function verifies if a file by the name BundleConfig resides in the file system under the App_Start folder /// or if a class by the name BundleConfig is present in the default namespace. /// </summary> /// <param name="context">The <see cref="CodeGenerationContext"/> provided by the core scaffolder.</param> /// <returns><see langword="true" /> if a file by the name BundleConfig is present under the App_Start folder or /// if a class by the name BundleConfig is present in the default namespace; otherwise, <see langword="false" />.</returns> public static bool IsBundleConfigPresent(CodeGenerationContext context) { if (context == null) { throw new ArgumentNullException("context"); } Project activeProject = context.ActiveProject; string defaultNamespace = activeProject.GetDefaultNamespace(); ICodeTypeService codeTypeService = context.ServiceProvider.GetService <ICodeTypeService>(); CodeType matchingConfigFile = codeTypeService.GetCodeType(activeProject, defaultNamespace + "." + CommonFilenames.BundleConfig); if (matchingConfigFile != null) { return(true); } string configFileNameWithExtension = CommonFilenames.BundleConfig + "." + activeProject.GetCodeLanguage().CodeFileExtension; return(File.Exists(Path.Combine(activeProject.GetFullPath(), CommonFolderNames.AppStart, configFileNameWithExtension))); }
public FeeScheduleController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo) : base(strepo, ctrepo, adrepo, ifrepo) { }
// Collects the common data needed by all of the scaffolded output and generates: // 1) Add ViewModel // 2) Add Controller // 3) Add View private void GenerateCode(Project project, string selectionRelativePath, SPCodeGeneratorViewModel codeGeneratorViewModel) { // Get Model Type var modelType = codeGeneratorViewModel.ModelType.CodeType; // Get the dbContext string dbContextTypeName = codeGeneratorViewModel.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); // Get the Entity Framework Meta Data //IEntityFrameworkService efService = Context.ServiceProvider.GetService<IEntityFrameworkService>(); //ModelMetadata efMetadata = efService.AddRequiredEntity(Context, dbContextTypeName, modelType.FullName); string methodName = _codeGeneratorViewModel.MethodTypeName; string controllerName = codeGeneratorViewModel.ControllerName; string controllerRootName = controllerName.Replace("Controller", ""); // add Metadata for Model string defaultNamespace = modelType.Namespace.FullName; MetaTableInfo queryMetaTable = _codeGeneratorViewModel.QueryFormViewModel.DataModel; MetaTableInfo resultMetaTable = _codeGeneratorViewModel.ResultListViewModel.DataModel; string outputFolderPath = Path.Combine(GetModelFolderPath(selectionRelativePath), modelType.Name + "ViewModels"); AddModelMetadata(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: outputFolderPath , defaultNamespace: defaultNamespace , modelTypeName: modelType.Name , methodName: methodName , queryMetaTable: queryMetaTable , resultMetaTable: resultMetaTable , overwrite: codeGeneratorViewModel.OverwriteViews); // Create Controller outputFolderPath = Path.Combine(selectionRelativePath, controllerName); AddMvcController(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: outputFolderPath , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: null/*efMetadata*/ , overwrite: codeGeneratorViewModel.OverwriteViews); if (!codeGeneratorViewModel.GenerateViews) { return; } // Create Views string viewRootPath = GetViewsFolderPath(selectionRelativePath); string viewFolderPath = Path.Combine(viewRootPath, controllerRootName); foreach (string viewName in new string[2] { "Index", "_Index" }) { AddView(project, viewFolderPath, viewName, controllerRootName, modelType , null /*efMetadata*/ , referenceScriptLibraries: codeGeneratorViewModel.ReferenceScriptLibraries , isLayoutPageSelected: codeGeneratorViewModel.LayoutPageSelected , layoutPageFile: codeGeneratorViewModel.LayoutPageFile , overwrite: codeGeneratorViewModel.OverwriteViews ); } //_ViewStart & Create _Layout if (codeGeneratorViewModel.LayoutPageSelected) { string areaName = GetAreaName(selectionRelativePath); AddDependencyFile(project, viewRootPath, areaName); } }
// Collects the common data needed by all of the scaffolded output and generates: // 1) Add Controller // 2) Add View private void GenerateCode(Project project, string selectionRelativePath, MvcCodeGeneratorViewModel codeGeneratorViewModel) { // Get Model Type var modelType = codeGeneratorViewModel.ModelType.CodeType; // Get the dbContext string dbContextTypeName = codeGeneratorViewModel.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(project: project, fullName: dbContextTypeName); //efService.AddRequiredEntity 正式會沒回應,改GetEfMetadata反射Model設定Metadata // Get the Entity Framework Meta Data //IEntityFrameworkService efService = Context.ServiceProvider.GetService<IEntityFrameworkService>(); //ModelMetadata efMetadata = efService.AddRequiredEntity(context: Context, // contextTypeFullName: dbContextTypeName, entityTypeFullName: modelType.FullName) var efMetadata = GetEfMetadata(modelType.FullName); // Create Controller string controllerName = codeGeneratorViewModel.ControllerName; string controllerRootName = controllerName.Replace(oldValue: "Controller", newValue: ""); string outputFolderPath = Path.Combine(path1: selectionRelativePath, path2: controllerName); string viewPrefix = codeGeneratorViewModel.ViewPrefix; string programTitle = codeGeneratorViewModel.ProgramTitle; //Alert.Trace("AddMvcController"); if (codeGeneratorViewModel.GenerateApiController) { AddMvcController(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: outputFolderPath , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , viewPrefix: viewPrefix , overwrite: codeGeneratorViewModel.OverwriteViews); } if (codeGeneratorViewModel.GenerateService) { AddService(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: PathHelper.ServiceOutPath(codeGeneratorViewModel: codeGeneratorViewModel) , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , viewPrefix: viewPrefix , overwrite: codeGeneratorViewModel.OverwriteViews); } if (codeGeneratorViewModel.GenerateRepository) { project = (Project)_visualStudioUtils.FindProjectByName("DAL").Object; AddRepository(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: PathHelper.RepositoryOutPath(codeGeneratorViewModel: codeGeneratorViewModel) , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , viewPrefix: viewPrefix , overwrite: codeGeneratorViewModel.OverwriteViews); } // add Metadata for Model if (codeGeneratorViewModel.GenerateViews) { AddListViewModel(project: Context.ActiveProject , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: PathHelper.ListViewModelOutPath(codeGeneratorViewModel: codeGeneratorViewModel) , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , overwrite: codeGeneratorViewModel.OverwriteViews); AddEditViewModel(project: Context.ActiveProject , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: PathHelper.EditViewModelOutPath(codeGeneratorViewModel: codeGeneratorViewModel) , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , overwrite: codeGeneratorViewModel.OverwriteViews); } ////_ViewStart & Create _Layout //string viewRootPath = GetViewsFolderPath(selectionRelativePath); //if (codeGeneratorViewModel.LayoutPageSelected) //{ // string areaName = GetAreaName(selectionRelativePath); // AddDependencyFile(project, viewRootPath, areaName); //} //// EditorTemplates, DisplayTemplates //AddDataFieldTemplates(project, viewRootPath); //// Views for C.R.U.D //string viewFolderPath = Path.Combine(viewRootPath, controllerRootName); //foreach (string viewName in new string[4] { "Index", "Create", "Edit", "EditForm" }) //{ // //string viewName = string.Format(view, viewPrefix); // //未完成 // /* // Index CustIndex // Create CustCreate // Edit CustEdit // EditForm CustEditForm // * // _Edit _CustEdit // */ // AddView(project // , viewFolderPath, viewPrefix, viewName, programTitle // , controllerRootName, modelType, efMetadata // , referenceScriptLibraries: codeGeneratorViewModel.ReferenceScriptLibraries // , isLayoutPageSelected: codeGeneratorViewModel.LayoutPageSelected // , layoutPageFile: codeGeneratorViewModel.LayoutPageFile // , overwrite: codeGeneratorViewModel.OverwriteViews // ); //} }
// Collects the common data needed by all of the scaffolded output and generates: // 1) Dynamic Data Field Templates // 2) Web Forms Pages private void GenerateCode(Project project, string selectionRelativePath, WebFormsCodeGeneratorViewModel codeGeneratorViewModel) { // Get Model Type var modelType = codeGeneratorViewModel.ModelType.CodeType; // Ensure the Data Context string dbContextTypeName = codeGeneratorViewModel.DbContextModelType.TypeName; IEntityFrameworkService efService = Context.ServiceProvider.GetService <IEntityFrameworkService>(); ModelMetadata efMetadata = efService.AddRequiredEntity(Context, dbContextTypeName, modelType.FullName); var oneToManyModels = GetOneToManyModelDictionary(efMetadata, efService, dbContextTypeName); // Get the dbContext ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); // Get the dbContext namespace string dbContextNamespace = dbContext.Namespace != null ? dbContext.Namespace.FullName : String.Empty; // Ensure the Dynamic Data Field templates EnsureDynamicDataFieldTemplates(project, dbContextNamespace, dbContextTypeName); EnsurePepositoriesTemplates(project, dbContextNamespace, dbContextTypeName); EnsureExtensionsTemplates(project, dbContextNamespace, dbContextTypeName); AddEntityRepositoryTemplates( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, efMetadata, codeGeneratorViewModel.OverwriteViews ); // Add Web Forms Pages from Templates AddWebFormsPages( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, efMetadata, codeGeneratorViewModel.UseMasterPage, codeGeneratorViewModel.DesktopMasterPage, codeGeneratorViewModel.DesktopPlaceholderId, codeGeneratorViewModel.OverwriteViews, oneToManyModels ); foreach (var dicitem in oneToManyModels) { var metadata = dicitem.Value; var modelName = this.GetModelName(efMetadata, metadata.EntitySetName); AddEntityRepositoryTemplates( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, metadata, codeGeneratorViewModel.OverwriteViews, modelName ); } // Add Web Forms Pages from Templates }
public SystemController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo, IFeeScheduleDtlService fsdrepo) : base(strepo, ctrepo, adrepo, ifrepo) { //_fsdrepo = fsdrepo; }
// Collects the common data needed by all of the scaffolded output and generates: // 1) Add Controller // 2) Add View private void GenerateCode(Project project, string selectionRelativePath, MvcCodeGeneratorViewModel codeGeneratorViewModel) { // Get Model Type var modelType = codeGeneratorViewModel.ModelType.CodeType; // Get the dbContext string dbContextTypeName = codeGeneratorViewModel.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); // Get the Entity Framework Meta Data IEntityFrameworkService efService = Context.ServiceProvider.GetService <IEntityFrameworkService>(); ModelMetadata efMetadata = efService.AddRequiredEntity(Context, dbContextTypeName, modelType.FullName); // Create Controller string controllerName = codeGeneratorViewModel.ControllerName; string controllerRootName = controllerName.Replace("Controller", ""); string outputFolderPath = Path.Combine(selectionRelativePath, controllerName); string viewPrefix = codeGeneratorViewModel.ViewPrefix; string programTitle = codeGeneratorViewModel.ProgramTitle; AddMvcController(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: outputFolderPath , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , viewPrefix: viewPrefix , overwrite: codeGeneratorViewModel.OverwriteViews); if (!codeGeneratorViewModel.GenerateViews) { return; } // add Metadata for Model outputFolderPath = Path.Combine(GetModelFolderPath(selectionRelativePath), modelType.Name + "Metadata"); AddModelMetadata(project: project , controllerName: controllerName , controllerRootName: controllerRootName , outputPath: outputFolderPath , ContextTypeName: dbContext.Name , modelType: modelType , efMetadata: efMetadata , overwrite: codeGeneratorViewModel.OverwriteViews); //_ViewStart & Create _Layout string viewRootPath = GetViewsFolderPath(selectionRelativePath); if (codeGeneratorViewModel.LayoutPageSelected) { string areaName = GetAreaName(selectionRelativePath); AddDependencyFile(project, viewRootPath, areaName); } // EditorTemplates, DisplayTemplates AddDataFieldTemplates(project, viewRootPath); // Views for C.R.U.D string viewFolderPath = Path.Combine(viewRootPath, controllerRootName); foreach (string viewName in new string[4] { "Index", "Create", "Edit", "EditForm" }) { //string viewName = string.Format(view, viewPrefix); //未完成 /* * Index CustIndex * Create CustCreate * Edit CustEdit * EditForm CustEditForm * * _Edit _CustEdit */ AddView(project , viewFolderPath, viewPrefix, viewName, programTitle , controllerRootName, modelType, efMetadata , referenceScriptLibraries: codeGeneratorViewModel.ReferenceScriptLibraries , isLayoutPageSelected: codeGeneratorViewModel.LayoutPageSelected , layoutPageFile: codeGeneratorViewModel.LayoutPageFile , overwrite: codeGeneratorViewModel.OverwriteViews ); } }
public ScholarshipController(IStudentService strepo, ICodeTypeService ctrepo, IAddressService adrepo, IFeeScheduleService ifrepo, IFeeScheduleDtlService ifsdrepo, IScholarshipService ischrepo, IScholarshipdtlService ischdrepo) : base(strepo, ctrepo, adrepo, ifrepo) { _ischrepo = ischrepo; _ischdrepo = ischdrepo; }
// Collects the common data needed by all of the scaffolded output and generates: // 1) Dynamic Data Field Templates // 2) Web Forms Pages private void GenerateCode(Project project, string selectionRelativePath, WebFormsCodeGeneratorViewModel codeGeneratorViewModel) { foreach (var codeType in codeGeneratorViewModel.ModelTypeCollection.Where(m => m.Selected)) { // Get Model Type var modelType = codeType.CodeType; // Get the dbContext string dbContextTypeName = codeGeneratorViewModel.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(project, dbContextTypeName); // Get the dbContext namespace string dbContextNamespace = dbContext.Namespace != null ? dbContext.Namespace.FullName : String.Empty; if (codeGeneratorViewModel.GenerateViews) { // Add Web Forms Pages from Templates AddWebFormsPages( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, codeGeneratorViewModel.Overwrite ); } if (codeGeneratorViewModel.GenerateController) { // Add Controllers from Templates AddControllers( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, codeGeneratorViewModel.Overwrite ); } if (codeGeneratorViewModel.GenerateApiController) { // Add Controllers from Templates AddApiControllers( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, codeGeneratorViewModel.Overwrite ); } if (codeGeneratorViewModel.GenerateStorageContext) { // Add Storage Contexts from Templates AddStorageContexts( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, codeGeneratorViewModel.Overwrite ); } if (codeGeneratorViewModel.GenerateScripts) { // Add Storage Contexts from Templates AddScripts( project, selectionRelativePath, dbContextNamespace, dbContextTypeName, modelType, codeGeneratorViewModel.Overwrite ); } } }