And OTOH, you don't have to generate exceptions but you'll get validation results, so you can ignore them or take different actions depending on the scenario.
2009/1/2 Greg Young <[email protected]> > > that breaks your constraints. Will your software trigger exceptions all > the > > time whenever an "invalid" instance is retrieved from the database ? > > How about perform validations when this instance is saved again and give > a > > chance to the user to fix the data if he/she finds it necessary ? > > You seem to be under the impression that data loads are primarily so > users can edit data. > > Unless you are in a forms over data type scenario I would say that > this is probably incorrect. Generally (in non-forms over data > examples) reads should be happening orders of magnitude more times to > be doing some kind of processing or validation of the data as opposed > to a user editing the data. > > If you are in such a scenario it is imperative that you stop at the > point that your data is broken to limit the scope of the damaged data. > If you don't you will end up with the bad data spreading from system > to system. > > Cheers, > > Greg > > 2009/1/1 Humberto Marchezi <[email protected]>: > > Hi, > > > > Is it really a good idea to validate instances retrieved from the > database ? > > > > For me, it sounds like a non-robust software. > > Imagine if someone or some external system performs updates in the > database > > that breaks your constraints. Will your software trigger exceptions all > the > > time whenever an "invalid" instance is retrieved from the database ? > > How about perform validations when this instance is saved again and give > a > > chance to the user to fix the data if he/she finds it necessary ? > > > > > > 2008/12/30 Ayende Rahien <[email protected]> > >> > >> What is real proxy? > >> > >> 2008/12/31 Greg Young <[email protected]> > >>> > >>> This leads to the use of "real proxies" as opposed to instance proxies. > >>> > >>> The use of real proxies leads to the "leaky this" problem. > >>> > >>> The "leaky this" problem leads to a great amount of complexity. > >>> > >>> Cheers, > >>> > >>> Greg > >>> > >>> 2008/12/30 Ayende Rahien <[email protected]>: > >>> > session.Load<Customer>(5); // doesn't hit the db, so we don't HAVE > any > >>> > way > >>> > to provide those values. > >>> > session.Get<Order>(15);// we need to provide a value for > >>> > Order.Customer, but > >>> > we don't want to load that data > >>> > > >>> > 2008/12/30 Krzysztof Koźmic <[email protected]> > >>> >> > >>> >> Do you mean proying dependencies for lazy loading? so that instead > of > >>> >> CustomerName instance I get a proxy? > >>> >> Can you elaborate on that? I'm not sure I understand your answer. > >>> >> > >>> >> Krzysztof > >>> >> > >>> >> Ayende Rahien pisze: > >>> >> > >>> >> Proxies > >>> >> > >>> >> On Tue, Dec 30, 2008 at 11:33 PM, Krzysztof Koźmic > >>> >> <[email protected]> wrote: > >>> >>> > >>> >>> Greg Young pisze: > >>> >>> > >>> >>> Fabio this discussion has already happened and I prefer to not > >>> >>> restate > >>> >>> the same positions as before but ... in terms of insuring > correctness > >>> >>> assuming that data from the database is correct is a nefarious at > >>> >>> best > >>> >>> course of action. > >>> >>> > >>> >>> > >>> >>> True, especially if you consider schema changes or access to DB > >>> >>> bypassing > >>> >>> the app. > >>> >>> I mean, aside from how NH is currently implemented - how is having > >>> >>> only > >>> >>> non-default .ctor and required value type dependencies a bad idea? > >>> >>> > >>> >>> Krzysztof > >>> >>> > >>> >>> On Tue, Dec 30, 2008 at 11:31 AM, Fabio Maulo < > [email protected]> > >>> >>> wrote: > >>> >>> > >>> >>> > >>> >>> 2008/12/30 Greg Young <[email protected]> > >>> >>> > >>> >>> > >>> >>> To not be able to insure validity upon construction is a very large > >>> >>> cost. > >>> >>> > >>> >>> > >>> >>> Really not for me; the default ctor is private and used only for > >>> >>> upload > >>> >>> from > >>> >>> persistence. > >>> >>> -- > >>> >>> Fabio Maulo > >>> >>> > >>> >>> > >>> >>> > >>> >>> > >>> >>> > >>> >>> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> > > >>> > > >>> > > > >>> > > >>> > >>> > >>> > >>> -- > >>> It is the mark of an educated mind to be able to entertain a thought > >>> without accepting it. > >>> > >>> > >> > >> > >> > > > > > > > > -- > > Humberto C Marchezi > > --------------------------------------------------------- > > Master in Electrical Engineering - Automation > > Software Consultant and Developer > > at the Town Hall of Vitória > > > > > > > > > > > -- > It is the mark of an educated mind to be able to entertain a thought > without accepting it. > > > > -- Sidar Ok http://www.sidarok.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
