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

objective c - iPhone and it's wireless area -

unix - Listing all shared memory segments used by a process on AIX5.3+ -

.net - Self Tracking Entities (STE)'s and partial updates with EF4 and mVC2 -