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
Post a Comment