Hi Again Andrés,
> Rocky said himself once that there was little value in
> making such class if you're using code generation, specially if all you're
> trying to do is save a few lines of code, since because they are generated,
> they are really cheap.
That's the real point: as the code is generated, there are two upsides
- it's cheap to do (you don't spend time doing it)
- no risk of making coding mistakes while repeating the same behaviour
(database access)
The point is
- currently there is no way in CslaGen to specify the second parameter
of the Update method / stored
I'll explain with a dummy (and maybe stupid) example
You have a Boys class and a Girls class. They are rather promiscuous
and each one of them may be related to many of the other.
So my Hetero table may be like this:
RelationID
BoyID
GirlID
...
and on Boys, my EditableChild GirlFriend value property collection may
be like this
RelationID
GirlID
...
and on Boys, my EditableChild BoyFriend value property collection may
be like this
RelationID
BoyID
...
In each of the EditableChild there is no need to repeat the object ID
(is pointless and bad design).
In this case, my Update methos / SP just refers to RelationID and
there is no problem at all - CslaGen can handle it (you just set
ParentInsertOnly to false)
But if my table has no RelationID, all CRUD methods / SP must have a
reference to both BoyID and GirlID
That's not a problem for Create, Insert and Delete. But for the
Update, I can set ParentInsertOnly to false but there is still no
other way to pass a second paramete:
For Boys, the parent ID is BoyID and I need to pass also the GirlID
parameter (and vice versa).
Criteria won't help as they don't apply to Updates.
Currently this is a problem/shortcomming in CslaGen. I think / need to
address the issue.
I understand I don't need to add a third class - evena static class -
in order to solve the problem. There is litle value and some
complexity added (an extra files in the project). Making a static
class raises a few (solvable) issues: the order that each object
passes the BoyID and GirlsID parameter to the static methods must be
the same (the generator must order them alphabetically)
So really what it's needed is a way to pass the "other" object ID.