StrataFrame Forum

Creating multiple BOs and want to auto-wrap code with Namespace

http://forum.strataframe.net/Topic22108.aspx

By Charles R Hankey - 2/26/2009

I have a nice utility that let's me highlight a block of code, right click, and add it to a new or existing region.



Now I find myself creating a huge number of BOs and I want each one to be part of the Lookups namespace. They alloinherit from a common LookupBaseBO, also in the Lookups namespace but my understanding is that namepace is not inherited. So I create each BO, then open the code, wrap the class code with Namespace Lookups ... end Namespace, then open the designer file and do it again. ( Hey, guess what, namespace names are case sensitive - who knew? )



(this is VB)



Anyway, does anybody know a faster way to do this - a macro, a snippet, a namespace wrapper ... suggestions ?






By Charles R Hankey - 2/27/2009

Decided to approach this another way and I like the result. I took one of the BOs I had created manually, which had the Namespace set in both the main file and the designer, and then replaced each instance of the BOname with $safeitemrootname$, then used the Export Template from the file menu, exporting an item template. Whatever I name the object created with ADD ITEM from the template will replace the token in code.



Since the and item created with ADD ITEM from the template will inherit from my baseBO, which is still available to me in the project I can create many many BOs this way and still be able to change the base class to add properties etc to all the BOs created from the template. (obviously the same principle used in the microfour templates but this is the first time I've done it for my own stuff so I'm pretty excited about it) BigGrin One more step toward RAD.



Still plan to dig up my old message where I was trying to invent a macro to do what ctrl-K-C does out of the box Wink and apply that logic to creating a namespace macro.