I'm trying to use t4toolbox to generate the linq2sql classes for a project. There is already a lot of code written against the default dbml generated code.
In the LinqToSqlEntityClassTemplate.tt file it has
/// <para>
/// While MSLinqToSQLGenerator generates field开发者_如何学Python 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>
Is there any way to make it generate the files in the default manner (Visual Studio way) instead of camelCasing and not having underscores?
The code generated by t4toolbox causes 400+ errors because of the field name differences.
You can copy the T4 Linq2Sql template that you want to modify in you project. You just have to make the same hierarchy as in T4Toolbox: at the root of your project, add a folder T4Toolbox/LinqToSql
and copy the template LinqToSqlEntityClassTemplate.tt
from your T4Toolbox install into your project. You just have to edit the FieldName
methods to change the naming of fields.
精彩评论