if i开发者_运维百科t's like this,i think it's troubles.
What is more trouble, a compile time error because you renamed a column or a run time error "Column xyz does not exist".
If you want to change the generated classes by yourself and are worried about your changes being overwritten. There are three ways to make modifications to the generated DAL.
SubSonic classes are partial.
If you create another class within the same namespace you can add properties/methods and override members (from the base class).
Modify the templates.
Depending on the SubSonic version (2 or 3) there are different approches how to generate the DAL. But they both share a similar aspx like syntax (2 = custom, 3 = T4 Engine)
Inherit from the classes.
You can create your own classes that inherit from the generated ones. (I would not suggest to do that if you want to use SubSonic2's xyzCollection.
Update: The T4 (*.tt) templates are executed only when you change the file or right click a tt file and choose "Run Custom Tool". For SubSonic, after a Schema changed you have to select "Run custom tool" for every tt file you want to update (ActiveRecord.tt, Structs.tt, etc.). However, T4 is a standalone tool that can be easily be integrated in your build process:
http://broloco.blogspot.com/2008/11/using-t4-command-line-parameters.html
If you are using Subsonic, the model is recreated each time the database is modified (automatically if you are using the build provider or manually if you are using Subsonic.exe to generate classes).
What is the problem with the fact that the model is regenerated?
精彩评论