StrataFrame Forum

Using Namespaces with strataframe BOs?

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

By Jiri Brazda - 6/30/2008

Hi

I need to organize my BOs in several namespaces. However it seems that it is not possible with Strataframe. When I manually update *.vb and *.Designer.vb files it works but when I rebuild classes with Business Object Mapper, the *.Designer.vb file lost the information about namespace...

I understand that Designer files are generated automatically but I didn't find any other method how to use namespaces.

Is there any correct way how to do it?

By Guillermo Vilas - 6/30/2008

Hello Jiri

I think this won´t be possible since the BO mapper overwrites the class designer (Designer.vb or Designer.cs) file every time you rebuild the mapped classes. The best way I can work around is doing one of these:



1) Setup the Root Namespace at Project property level for the entire BO dll

2) Creating a stand alone BO dll for each Business Logic: eg. YourCompany.YourProduct.BO.Sales.dll, YourCompany,YourProduct.BO.Inventory etc...

3) Wait until you are sure you wont need to map the classes anymore (at least for production release) and apply your namespace manually.



Hope this help and I´m pretty sure the experts will add comments too. Smile
By Trent L. Taylor - 7/1/2008

Actually the Namespace will be left alone once it has been added or changed within the *.vb and *.designer.vb file.  Based on this post I went and re-verified this since I was confused as to what you were posting.

If you open up a BO and add a namespace to both the .vb and the partial class (.designer.vb), the namespaces will stick, even after a partial class rebuild.  I have tested this and I know that we have a lot of developers that have this as a requirement within their shops and use this logic on extremely large environments, so I am very confident that this works.

CustomersBO.vb

CustomersBO.Designer.vb

If this is how the BOs are structured, then you go in and rebuild the partials, the namespace will be left intact.

By Guillermo Vilas - 7/1/2008

Thanks Trent,

I´ve always been told not to stick on assumptions (I hope this is correct in English). And I did by assuming the BO mapper will overwrite the entire designer file. Though I´ll test it too. BigGrin
By Trent L. Taylor - 7/1/2008

No problem at all...I apprecate your contributions out here on the forum and you are right on the money for the rest of the designer file.  But this is something that we specifically took into account.
By Greg McGuffey - 7/1/2008

I use namespaces to organize my BOs and it works great. Just edit the BO .vb and .designer files with your namespace once and your good to go.
By Jason Seidell - 7/11/2008

We use namespaces/libraries for all our BO's, however we just create a seperate library project for each set of BOs and then just set the namespace through the Project properties which will apply to all the BOs in that project.  Then your BO's are just a reference away from being ready for any other project you have.