Hi,
Suppose I have a class:
public class Person
{
private string _name;
public virtual string Name
{
set
{
if (_name == string.Empty) throw new NameInvalidException();
_name = value;
}
}
Name property prevents a person to have an empty name and that´s ok if I am
saving this object.
However when I am reading from the database, I want this object to be fault
tolerant thus this
rule (empty name checking) does not apply in this case.
However if I remove this rule from the property, the problem turns into the
opposite.
Name property becomes dumb and accept anything as an input
what solves the reading problem but creates another one in the saving
situation.
This problems seems to be very common and some of you probably made some
decision about it.
How did you handle this situation ? Is there any best practices ?
Thanks
--
Humberto C Marchezi
---------------------------------------------------------
Master in Electrical Engineering - Automation
Software Consultant and Developer
at the Town Hall of Vitória
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---