t4

How to generate whole boiler plate code for CRUD operations like visual studio using code?

我的未来我决定 提交于 2021-02-18 17:09:49
问题 I am trying to generate CRUD operations for entities of my database tables like with respective endpoints to consume. It is same as the visual studio generates boiler plate code for Authentication(Account controller),and also crud operation in the form of whole package. I have came across t4 templates but not getting how to use it to generate crud operations for my database table entities. I am also trying to generate whole application package with Application name,references(dll),Controller

Unable to watch variables during debug of T4 templates after updating to Visual Studio 2015 Update 2

与世无争的帅哥 提交于 2021-02-09 03:56:47
问题 After Updating Visual studio 2015 from VS2015 Update 1 to Update 2. I can no longer watch or inspect variable values during T4 template debugging As you can see, the watched variables are not found in the current context. This was previously working in Visual Studio 2015 update 1 Here is a Screenshot in visual studio while debugging a T4 template: 回答1: I had the same trouble. Try this "Debug->Options->Debugging:General-> set checkbox on the Use Managed Compatibility Mode". 回答2: This looks

Using project references as assembly paths in T4

Deadly 提交于 2021-02-06 08:56:44
问题 I have a .tt script that needs to reference a couple of external assemblies. Is it possible for the T4 host to automatically include the assemblies referenced in the project - rather than me manually adding an assembly directive for each one? E.g. Referencing an assembly from a nuget is a moving target when using a path relative to $(ProjecDir) . Using assembly paths like $(Project)\bin\Debug\Example.dll also seems less than optimal - as it requires the build to have been successful

Using project references as assembly paths in T4

百般思念 提交于 2021-02-06 08:54:15
问题 I have a .tt script that needs to reference a couple of external assemblies. Is it possible for the T4 host to automatically include the assemblies referenced in the project - rather than me manually adding an assembly directive for each one? E.g. Referencing an assembly from a nuget is a moving target when using a path relative to $(ProjecDir) . Using assembly paths like $(Project)\bin\Debug\Example.dll also seems less than optimal - as it requires the build to have been successful

T4 template VS2010 get host assembly

不问归期 提交于 2020-07-05 03:34:09
问题 I want to get a reference to assembly of a project in which T4 template is. I know I can get path to the project with, for example Host.ResolveAssemblyReference("$(ProjectDir)") and I could maybe add bin\\debug\\{projectName}.dll because my assembly names are named by project name, but that is not always the case and I'm creating reusable template, so I need path to dll or most preferably Assembly instance. I have also found how to get reference to the Project as explained here in method

How get Attribute Value in CodeAttribute

こ雲淡風輕ζ 提交于 2020-05-29 03:54:12
问题 I wrote a method to get Attribute Value By Property: public string GetAttributeValueByNameAttributeAndProperty(CodeClass cc, string nameAttribute, string nameProperty) { var value = ""; foreach(CodeAttribute ca in cc.Attributes) { if(ca.Name.Contains(nameAttribute) && ca.Value.Contains(nameProperty)) { value = ca.Value.Remove(0,ca.Value.IndexOf(nameProperty)); value = value.Replace(" ",""); if(value.Contains(",")) value = value.Remove(ca.Value.IndexOf(",")); } } return value; } For Example: I

How get Attribute Value in CodeAttribute

社会主义新天地 提交于 2020-05-29 03:52:21
问题 I wrote a method to get Attribute Value By Property: public string GetAttributeValueByNameAttributeAndProperty(CodeClass cc, string nameAttribute, string nameProperty) { var value = ""; foreach(CodeAttribute ca in cc.Attributes) { if(ca.Name.Contains(nameAttribute) && ca.Value.Contains(nameProperty)) { value = ca.Value.Remove(0,ca.Value.IndexOf(nameProperty)); value = value.Replace(" ",""); if(value.Contains(",")) value = value.Remove(ca.Value.IndexOf(",")); } } return value; } For Example: I

Is it possible to use latin character in comments of t4 template?

拈花ヽ惹草 提交于 2020-04-18 07:06:39
问题 I'm trying to create a portuguese comments in a t4 template of the Add Controller in my project. The comments in t4 template: /// <summary> /// Controller que trata as requisições de pesquisa, inclusão, alteração e exclusão de <#= mvcHost.ControllerName.Replace("Controller", "") #>. /// </summary> The problem is when i add a controller, the comments appear like this: /// <summary> /// Controller que trata as requisi��es de pesquisa, inclus�o, altera��o e exclus�o de Teste. /// </summary> Obs:

T4 Include file path from project root

我是研究僧i 提交于 2020-02-20 07:18:05
问题 How can I include file relatively to project root? Somthing like <# @include file="~/Infrastructure/Manager.ttinclude" #> 回答1: You should use $(ProjectDir) <#@ include file="$(ProjectDir)\Infrastructure\Manager.ttinclude" #> You can also use $(SolutionDir) for the Solution root. 回答2: if you want to include file in some shared project then you can use below <#@ include file="..\AnotherProjectFolderName\AnotherSubFolder\Shared.ttinclude" #> First .. will be resolved to current file path So if

oracle 导出EXCEL数据

二次信任 提交于 2020-02-05 09:05:09
SELECT t1.COLUMN_id AS "序号", t3.comments AS "类别", t2.Comments AS "属性", t1.DATA_TYPE AS "类型", t1.DATA_LENGTH AS "长度", NVL(t1.data_scale, 0) AS "小数位数", CASE WHEN t1.NullAble = 'N' THEN '是' ELSE '否' END AS "必填" -- t1.Column_Name AS "字段名称", --t1.Table_Name || chr(13) AS "表名称及说明" --t4.created AS "建表时间" FROM cols t1 LEFT JOIN user_col_comments t2 ON t1.Table_name = t2.Table_name AND t1.Column_Name = t2.Column_Name LEFT JOIN user_tab_comments t3 ON t1.Table_name = t3.Table_name LEFT JOIN user_objects t4 ON t1.table_name = t4.OBJECT_NAME WHERE NOT EXISTS (SELECT t4.Object_Name FROM User_objects t4