When you create an object of type EditableSwitchable is it ever necessary to also have an EditableRoot and EditableChild object also? Or is simply having the EditableSwitchable enough and you then create them as whichever you need?
Working with a code generator I am trying to derive as many objects from the metadata as possible and I am wondering if I should go ahead and create all 3 types or just create the EditableSwitchable.
Thanks,
Will
Bayu is right in that the intent of a Switchable object is just that, to be able to either instantiate it as a root here and as a child there, etc...
But beware. I can certainly understand was you would want to create _all_ of your objects as swtichable objects, but a switchable object is in most cases a sign of bad design.
I think you should nail down your object's responsibility and then create (generate) the appropriate root or child objects as required. You should, at least IMHO, put the breaks on using nothing but switchable objects.
Anyway, that is my 2 cents :(
Sorry to jump in here, but this brings up something I've wondered about since using CSLA.
I've never used a switchable object, and the mantra is it's usually bad design to do so. But it's included in the framework, so I guess there are valid reasons to use a switchable object? Can anyone give an example of when it's a good idea to use a switchable object?
Thanks,
Mike
Thanks guys.
I will remove my generation for EditableSwitchable and simply generate the Parent and Child objects.
This clarifies a lot.
And yes, I am addicted to CodeSmith now. I am currently working a master template to generate a bulk of my business objects and all of my stored procedures.
Will
Will,
EditableSwitchable is a class type for objects that are times root and times child of another object or collection.
If you create your objects as EditableSwitchable you dont have to do the other two, but having all objects as editableSwitchable will make them do a lot of extra work and expose it to possible miss-usage by the UI.
Fabio
Copyright (c) Marimer LLC