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

asp.net - Change the driver in the connection string to a data source in VB.Net -

Getting started consuming web services in a Ruby on Rails 3 application -

objective c - iPhone and it's wireless area -