Comments curiosity

Posts   
 
    
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 24-Feb-2005 23:36:52   

Can you elaborate on these comments in the generated code?

        /// <remarks>This property is added for conveniance, however it is recommeded to use the method 'GetSingleAccountStoreOwner()', because 
        /// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the
        /// same scope. The property is marked non-browsable to make it hidden in binded controls, f.e. datagrids.</remarks>
        [Browsable(false)]
        public virtual AccountEntity AccountStoreOwner

BTW instead of saying "binded" say "bound" simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Feb-2005 10:02:48   

I added that comment to be sure design guideline pundits (not you, but the peope who believe FxCop is the one source for checking if you're doing a good job) would be happy as well simple_smile . The reason is that MS' library guidelines say that properties should be inexpensive routines, if the property can take a long time (which is the case with fetching related objects), it should be transfered into a method. However, you can't bind to a method, you need a property, so that's why I also added the property simple_smile . It's 'wrong' according to the guidelines, but necessary because databinding otherwise won't work simple_smile , so that's basicly the explanation for that comment.

I'll change that 'binded' into 'bound' wink

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 25-Feb-2005 14:54:02   

Ah, I understand perfectly. I was aware that accessing that property would cause a fetch, but never thought about how this conflicts with the guideline that properties be inexpensive. In this case, the guideline doesn't fit very well.

I thought maybe this usage was going to be phased out, and I really like it.

Thanks.