Fábio, my NH version differs from yours. In my case had to do:

public class GenericSqlExceptionConverter : ISQLExceptionConverter
    {
        #region ISQLExceptionConverter Members

        public ADOException Convert(Exception sqlException, string message,
SqlString sql)
        {
            var sqle = ADOExceptionHelper.ExtractDbException(sqlException)
as SqlException;

            return SQLStateConverter.HandledNonSpecificException(sqle,
message, sql);
        }

        #endregion
    }

I'm doing this just to check it out, but I dont get error.  :(

Something to point out ?


2009/12/18 Fabio Maulo <[email protected]>

>
> http://fabiomaulo.blogspot.com/2009/06/improving-ado-exception-management-in.html
>
> 2009/12/18 Paulo Quicoli <[email protected]>
>
>> Hi friends, I'm using here NH 2.1.0.1003 and unhAddings to manage my
>> sessions (CpBT).
>>
>> I would like to get correct Exception from ADO.NET about foreign key
>> violation... is there a way to do that?
>> Before trying that, I was thinking about in my Delete routine, search for
>> relations, to prevent user of deleting something already in use... but it
>> would cost so much. So I decided try to catch ADO.Exception and check it
>> message text for 'foreign'. So, if there is 'foreign' text in exception
>> text, it is a violation and I can alert saying "Impossible to exclude".
>> something like that.
>>
>>
>> Thanks everybody
>>
>> --
>> Paulo R. Quicoli
>>
>> Editor Técnico - ClubeDelphi Magazine - DevMedia
>>
>> --
>> 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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>
>
> --
> Fabio Maulo
>
>  --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>



-- 
Paulo R. Quicoli

Editor Técnico - ClubeDelphi Magazine - DevMedia

--

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.


Reply via email to