Wht is the best option?

Wht is the best option?

Old forum URL: forums.lhotka.net/forums/t/3139.aspx


lprada posted on Wednesday, July 04, 2007

If you have a field of client in a Invoice what would you do

 

private int _clientId or

private Client _client

 

 

 

 

JoeFallon1 replied on Wednesday, July 04, 2007

It depends on the use case. <g>

But I would lean toward:    private int _clientId

Then you could always use it to fetch the Client BO later.

Joe

 

 

wurzulator replied on Thursday, July 05, 2007

I have tried both and I found the object version limiting as sometimes you have different BOs representing the child item.

For example I might have a Read-Only ClientInfo class and an Editable Root Client class which I need to invoke based on the Invoice. Using the id only gives me the flexibility to choose.

I use my own class building templates - and I found that these templates were easier to set up, especially with regard to data access if I used the int/Guid id method.

lprada replied on Thursday, July 05, 2007

I am curious about your templates, can you publish them?

wurzulator replied on Tuesday, July 10, 2007

Attached find source code:

Please note that these are REALLY hacked together and in no way represent the way I code Wink [;)].

Secondly, and far more importantly the classes generated by the classbuilder violate the philosophy of CSLA in that they are generated from data rather than behaviour. As a result they should only be used as first drafts or in really simple Use Cases.

lprada replied on Tuesday, July 10, 2007

Cannot find the link, can you send to lprada@gmail.com

jupp replied on Tuesday, July 10, 2007

Hi, please look at http://forums.lhotka.net/forums/post/3047.aspx

Copyright (c) Marimer LLC