コード例 #1
0
        public IndividualEntity Retrieve(int id)
        {
            // Guard against invalid arguments.
            if (id < 1)
            {
                throw new ArgumentOutOfRangeException("id");
            }

            try
            {
                // Retrieve returns null if a record isn't found.
                return(repository.Retrieve(id));
            }
            catch (Exception exception)
            {
                // Throw an exception if the Id was not returned.
                throw new InvalidOperationException("Failed to retrieve.", exception);
            }
        }