c# - TryFindByPrimaryKey in Castle ActiveRecord -


How do I search for a record by the primary key, but if it does not exist, then return empty?

Public Fixed T FindByPrimaryKeyOrDefault (Object ID) {Try {ActiveRecordMediator returns; T & gt; .FindByPrimaryKey (id); } Hold (NotFoundException) {return tap; }}

  ActiveRecordMediator & lt; T & gt; .FindByPrimaryKey (id, false);  

I'll copy questions like these.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -