开发者

Linq-To-SQL Code Generator - How to Modify the Template?

开发者 https://www.devze.com 2022-12-19 18:14 出处:网络
We\'re using Linq-To-SQL in one of our projects, and I like to modify the template the code generate uses to add some Code A开发者_运维技巧nalysis suppression attributes. Anyone know how I can do this

We're using Linq-To-SQL in one of our projects, and I like to modify the template the code generate uses to add some Code A开发者_运维技巧nalysis suppression attributes. Anyone know how I can do this?


Have a look here (by Damien Guard), it provides a good rundown on using T4 Templates for this purpose.

Also, looks like he's since posted the whole thing on CodePlex: LINQ to SQL templates for T4


Many of the Linq-To-SQL classes are implemented as partial classes. If you implement your own partial class (http://msdn.microsoft.com/en-us/library/wa80x488%28VS.80%29.aspx) you could added the attributes to it. By using the partial class you avoid the risk of your attributes being removed the next time the Ling-To-SQL classes are generated.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号