问题标签 [t4scaffolding]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asp.net-mvc-4 - 在 Scaffold 选项下的 Add New Controller 对话框中添加新的 Custom T4 模板
我想实现新的 T4 模板,它应该出现在 Add New Controller 对话框的 Scaffold 选项下。
我已经尝试添加一个新的 View tt 模板。我能够添加它。我需要一份参考资料,从中可以获得有关如何创建新控制器模板而不是修改现有控制器模板的基本信息。
谢谢帕蒂尔
asp.net-mvc-scaffolding - T4Scaffolding 访问泛型集合 T 属性
给定以下课程:
和我的 ps1 入口代码:
其中 $model 是 Post 类。
我将如何访问“标签”对象属性?
我有“标签”ICollection 作为 EnvDTE.CodeTypeRef。
我注意到大多数 mvcscaffolding 都使用 Get-RelatedEntities 来展开泛型 - 这是访问 Tag 属性的唯一方法吗?
c# - 通过 T4Scaffolding 生成 CustomScaffolder 时找不到“DynamicTransform”
我正在尝试将 T4Scaffolding 用于我当前的项目,但一开始就失败了。
我在此链接上逐步执行相同的过程,该过程教如何将 T4Scaffolding 用于基本控制台应用程序。
我做的步骤
1-我创建了一个新的控制台应用程序(.NET 4.0)
2-我使用包管理器控制台成功安装了 T4Scaffholding (install-package t4scaffolding)
3-我尝试使用包管理器控制台创建一个演示自定义模板
Scaffold CustomScaffolder T4Demo
然后它抛出下面的异常
我究竟做错了什么 ?
powershell - T4 Scaffolding - 如何检测可空类型
我正在尝试通过加载另一个类作为模型来生成一个类,这是我正在使用的类\模型
正如您所看到的,有一些可以为空的类型public string BandName? { get; set; }
是我遇到问题的地方。我可以成功地制作输出类,但是当模型的属性可以为空时,我想检测它并采取相应的行动,我不知道该怎么做。
这是我的 t4 模板
在Map(x=>x.<#= property.Name #>).Column("<#= property.Name #>");
我想检查属性是否可以为空之前,如果不是我想指定Map(x=>x.<#= property.Name #>).Column("<#= property.Name #>").NotNullable();
怎么做
以防万一这是我的 .ps1 powershell 脚本
powershell - T4Scaffolding - get list of files from a directory
usually what we do is for scaffolding we specify a model, the thing is i have more than hundred models, i want to get list of all the files from a namespace.project directory and run scaffolding against all of them.
I am using template in ps1 script to generate code
t4 - T4 脚手架 - Powershell 脚本
我正在研究 T4Scaffolding,我正在使用模型生成代码,问题是模型,那是 DB 的 POCO,它必须有一个定义的主键,否则我的代码会失败,
这是我的命令
脚手架 MyScaffolder smArtistDetails -Force
这是 .ps1 脚本
这是我的 74 模板代码
怎么办.. 如果找不到主键,我想遵循不同的输出\生成方法。
我应该从脚本切换到不同的模板,如果是,那么如何
或者我应该在这个模板中处理这个,如果是,那么如何。
c# - 通过 T4Scaffolding 将静态文件添加到项目
我正在使用 T4Scaffolder 生成一个 CMS,并且所有 CS 文件都已成功生成。但我也想在项目中添加一些 css 和 png 文件。
使用 powershell 注释将静态文件添加到 MVC Web 应用程序的最佳方法是什么?
我什至可以通过为每个模板添加 t4 模板来将 css 文件添加到项目中,但我不能对图像文件做同样的事情。我需要一些东西来将现有文件夹复制到 MVC Web 应用程序项目。
repository-pattern - ASP.NET mvc scaffolding with existing repository and mapping POCO to viewmodels
I have an asp.net mvc solution with three projects
- UI ASP.NET MVC
- POCO My Domain POCO objects
- Repository using entity framework and t4 to generate context and POCO classes
I want my UI project to use ViewModels not the POCO classes.
I need to do scaffolding for UI and For Repository independently (i start with repository scaffolding, and then customize some code and then i will scaffold the uicontrollers view viewmodel)
I do Repository scaffolding in the repository project like this : scaffold Repository -ModelType POCO.User -DbContextType Context this is working like a charm
But in In the default mvcscaffolding template when i use the controller scaffolding : scaffold Controller -ModelType POCO.User -ControllerName UsersController -DbContextType Repository.Context -Repository
- It will detect that the User is already in the context so will skip it (that's good).
- It Will scaffold wiews using POCO.User as model (that's not what i want, i want it to generate ViewModel Class and use it)
- It will Generate Repository (that's not good Too since i have already my repository in Repository Project)
- It will scaffold controller with the repository created and send POCO to the views (not good too)
So i want to do something like this scaffold Controller -ModelType POCO.User -ControllerName UsersController -DbContextType Repository.Context -RepositoryType Repository.UserRepository -GenerateViewModel
that will skipp repository creation but use it in the controllers, that generates ViewModels from the poco and make mappion using automapper for example and use viewmodel in the view.
Any help where to start is apreciated. Thanks
powershell - T4 PowerShell 数组序列化错误
我正在使用 T4Scaffolding 创建自定义脚手架。我使用以下 PS 代码获取项目中所有域对象的列表:
然后我像这样调用 Add-ProjectItemViaTemplate 方法:
运行 sacffold 时出现以下异常:
问题似乎是 $domainClasses 变量由于某种原因无法序列化。我究竟做错了什么?
visual-studio-2012 - 右键单击 VS2012 解决方案上的“属性”显示:“对象未设置为对象的实例”错误
从 NServiceBus v3 升级到 v4 后,尝试在 VS2012 中查看解决方案的属性对话框时,开始收到“对象引用未设置为对象的实例”错误。
这个问题看起来和这篇文章中提出的一样,很抱歉有任何重复。这篇文章是在将近一年前提出的,我希望 NServiceBus 社区中的其他人可能已经找到了解决方案。
很确定违规者是 NServiceBus 4 所依赖的 T4Scaffolding.Core 库(如上面帖子中的 kevin_fitz 所建议的)。如果我卸载 NServiceBus,问题就消失了——但这会带来许多其他问题 :) NuGet 不会让我卸载 T4Scaffolding.Core,因为 NServiceBus 依赖于它。
非常感谢任何帮助!提前致谢。