I get a Exception type using
catch(Exception e){
log.Error(e.GetType()); // it write 'System.Data.EntityException'
}
so I change my code to catch that exception,
try{
...
}catch(EntityException a){
// need to do something
log.Error("I got it!");
}catch(Exception e){
log.Error("No");
}
and the code write only "No".
How can I catch the EntityException before reach Exception?
Thanks
throw new System.Data.EntityException();directly and see if it is caught.catch(System.Data.EntityException a)"I got it! " + a.GetType().ToString()ande.GetType().ToString()... just to verify that when the bottom-most catch is invoked it really is getting what you believe its getting.