2016年5月19日 星期四

自訂工具介紹--LINQtoSQL: Customize the Code Generated by the Designer

Refer: http://www.codeproject.com/Articles/31519/LINQtoSQL-Customize-the-Code-Generated-by-the-Desi

 

如要自訂 Linq To Sql 的 Class 可以用參考網址的方式來設定。

轉貼介紹如下:

Introduction

LINQ to SQL is used to manipulate data in a SQL Server database. Visual Studio ships with the LINQtoSQL designer which is a very powerful tool to generate LINQ. It is fast, easy to use, and great in lots of aspects.

There is a shortcoming though. You cannot customize the generated code. As with basically all the other designers, it works, it's easy to crank up a demo, but once you get in real life situations, you always want that little bit more. That extra bit is always something that depends on the problem. I will, therefore, not attempt to create better LINQ to SQL code. I will just show you how to customize and enrich the generated code in a matter of minutes. The customization is completely transparent to the standard LINQtoSQL designer, and you will still be using it for modeling your classes and data access.

沒有留言: