开发者

Adding more attributes to LINQ to SQL entity

I want to add browsable attribute to some properties for entities generated by LINQ to SQL.

Is it a good idea? Since these entities are auto-generate开发者_JAVA技巧d, and when I regenerate they (the attributes I have added) might be overwritten.


I would probably use Damien Guards LINQ to SQL T4 templates, and modify the template to include the attributes you need. Then the attributes will be generated when you regenerate the classes.


You cannot add additional attributes to the properties in another partial class file because you would be defining the property more than once. This is one reason, among others, that we created our own code generator that generates L2S entity classes the way we want them.

Our code generator also generates a second set of 'application' entities that are much more lightweight than the L2S entities and used at the application level. They contain no L2S plumbing, but do contain other characteristics that the application level finds useful.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜