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

php - multilevel menu with multilevel array -

.net - C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL -

objective c - iPhone and it's wireless area -