Actual it is not. I all my object initialization via constructor and
require a fully valid object. I use a private no arg for ORM usage.
My objects have methods not many getters/setters, I do not use
getters/setters unless they are truly called for.
If data in the database is invalid it is still necessary that the
object be re-hydrated to allow for correction. if the data had to
pass the validation of getter/setters it would fail.
Example objejct
I would like to set all of the private fields with no need to any
getters/setters
public class order
{
private Iset<orderline> _lines
private IAddress _address
private bool _shipped;
public Submit()
{
if (_lines.count!=0)
{
_shipped=true;
}
else
{
throw new exception()
}
}
}
On Oct 4, 10:24 am, Patrick Steele <[email protected]> wrote:
> Um, that's the *opposite* of encapsulation. By giving access to
> private fields, anyone can change the value of the field -- so the
> access to the fields is no longer encapsulated to just your
> getters/setters.
>
> ---
> Patrick Steelehttp://weblogs.asp.net/psteele
>
>
>
> On Mon, Oct 4, 2010 at 7:52 AM, MWightman <[email protected]>
> wrote:
> > I would much prefer to map to private fields not public properties for
> > the sake of encapsulation. Can AR map relations and collections to
> > private fields?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Castle Project Users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.