On Friday, July 29, 2016 at 12:38:07 PM UTC+1, Oskar Berggren wrote: > > The text in NH-3500 hints at this only being an issue if you use lazy > properties (not the same as collections) which I suspect are used by few. > Does this hold in your case. >
Yes I have plenty of Lazy properties. Typically one of the reasons I upgraded to NH4. lol. Although I don't understand how/why the behaviour is different when using lazy properties. Seems a bit weird to have one behaviour for a class mapped with lazy props and another behaviour for one with. > Apart from that, and this is just a hypothesis, it may also be that few > people throw the sort of exceptions you would typically act upon (other > than logging/display), from inside the domain model. Similar things can be > done with explicit methods/return values to validate things that matter to > the surrounding code. > Yes I take your point there are other ways of sorting out Exceptions. > If you think you can find the place for where this should be changed in > NH, a test case and patch would be entertained. > Can I just subclass the default ProxyFactory and override the method I think is at fault? If so how to I tell NH to use my class over the default one? > > 2016-07-29 12:32 GMT+01:00 Mark Perry <[email protected] <javascript:>>: > >> What I don't get is how folks deal with Exceptions coming from NH objects >> since this behaviour was introduced. >> >> I mean EVER error thrown from Domain Objects needs to have the >> innerExceptionChecked. >> >> Is everyone doing this? >> >> using (var tran = _session.BeginTransaction()) >> { >> var customer = _session.Get<Customer>(1); >> try { >> customer.DoSomething(); >> } >> catch(TargetInvocationException ex){ >> var realExecption = ex.InnnerException; >> //Check Exception Type, do some logic etc... >> } >> tran.Commit(); >> } >> >> It's madness. Yes I understand why it's happening and I get it I just >> don't see that its at all useful from a dev standpoint. >> >> >> >> Mark >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/nhusers. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
