This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Is it possible to extend the 'template' for the LS designer? So when I had a new "LightSpeed Model" to my solution explorer it creates not only the .lsmodel & .lsmodel.cs files but one additional .cs file (perhaps named something like .CustomCode.cs) and nests it under the .lsmodel file? I find that I'm constantly having to create an additional .cs file containing the same namespace and classes so I can add custom code (such as events & methods) so they're not over written when I make changes in the designer interface? This would be a really neat little feature ;) Thanks. sr |
|
|
No, you can't have the designer create an additional file, though you can modify the templates to put extra stuff into the generated file. But if the idea is to add custom code in a separate file that isn't under designer control, why not just create partial class files for the entities you need to extend? That's the usual idiom and I think it's easier to navigate than having a single Model.CustomCode.cs file. And we provide a handy shortcut to create partial class files with the right namespace and class name: right-click > Refactor > Create Partial Class. |
|
|
Hi, I am already creating partial class files to keep my custom code separate (and safe) from the designer. I guess it's a matter of opinion & preference, I find it more neat and clean to have my .custom.cs file nested under along with the other partial class file. Did not realize the shortcut for 'create partial class'.. will give that a go. Thanks! |
|
|
If you want to have a file appear nested under the .lsmodel, I think you can do this by hacking the .csproj file and adding a |
|
|
Thanks, but it looks like that would have to be done one per file, not project. A little too tedious for my taste. But I found a tool that does it more easily and for free: VSCommands. After installing the plugin through extenstions manager, restart VS, then select the files you want to link, right click, and click on 'Group Items'. Voila! |
|