EditableRoot: Get<BusinessObject> with data reader & CodeSmith templates

EditableRoot: Get<BusinessObject> with data reader & CodeSmith templates

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


noyceb posted on Monday, March 12, 2007

Greetings,

This may just be a Rocky question, but we are utilizing the CSLA CodeSmith templates (RC1.1.0) with CSLA 2.1.4 to generate our core objects.  One of the challenges we have is whenever the generated code attempts to load a root object from list (whether editable or read only), it does so utilizing a call get Get<BusinessObject>(SafeDataReader dr) - the issue is that this method does not exist (e.g. is not generated with the templates)!

Therefore, my question is this:  should we modify the templates to include this method for root objects, or is there a good reason that the framework omits this?  We want to be certain we adhere as close to the core of the framework as possible.

Disclaimer:  I have not traversed every chapter in the book; thus, I may be asking a very silly question here.

Thanks in advance!

ajj3085 replied on Monday, March 12, 2007

I think the templates are meant to be a jumping off point.  Certainly I would think you could modify them as you need.

noyceb replied on Monday, March 12, 2007

Definately agree.  However, my question is more from a framework perspective...Is there a good reason that this construction method was (or should be) omitted?

ajj3085 replied on Monday, March 12, 2007

Why is that method not in the framework?  Probably because its not safe to assume everyone is loading form SafeDataReader.

noyceb replied on Monday, March 12, 2007

I intended this question to be more along the lines of "is there any reason according to the framework that a root object should be treated differently than that of a child object when dealing with lists?"; I never really cared about the data source subject - my bad for including it in the post.  I think the overall answer here is the usual "yes and no; it depends on your implementation" - I was hoping instead that the framework would provide some hard-line guidance in this matter.

Thanks for your posts.

JoeFallon1 replied on Tuesday, March 13, 2007

Page 87 of the eBook is titled:

Altering the EditableRoot Template

 

This change is required to support a new type of BO named:

EditableRootListBase

If you don't plan to use ERL then you do not need to modify the ER template.

So if you want to modify the template you should make it conditional - SupportsERL (T/F).

Joe

 

Copyright (c) Marimer LLC