English 中文(简体)
T4工具箱Linq2Sql
原标题:T4 Toolbox Linq2Sql

我正在尝试使用t4toolbox为项目生成linq2sql类。已经有很多代码是针对默认dbml生成的代码编写的。

在LinqToSqlEntityClassTemplate.tt文件中

/// <para>
/// While MSLinqToSQLGenerator generates field names as property name with an
/// underscore prefix, this method simply converts the property name to camelCase.
/// This is done for consistency with the StyleCop rule SA1306: Variable names
/// must start with a lower-case letter.
/// </para>

有没有办法让它以默认方式(Visual Studio方式)生成文件,而不是使用camelCasing和不使用下划线?

t4toolbox生成的代码由于字段名称的差异而导致400+个错误。

最佳回答

您可以复制要在项目中修改的T4 Linq2Sql模板。您只需要制作与T4Toolbox中相同的层次结构:在项目的根目录下,添加文件夹T4Toolbox/LinqToSql,并将模板LinqToSqlEntityClassTemplate.tt从T4Toolbox安装复制到项目中。您只需编辑FieldName方法即可更改字段的命名。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签