Skip to content

Instantly share code, notes, and snippets.

@hbulens
Created January 13, 2018 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbulens/fa4243ce9aea95e4d98178eb47c3473d to your computer and use it in GitHub Desktop.
Save hbulens/fa4243ce9aea95e4d98178eb47c3473d to your computer and use it in GitHub Desktop.
public IEnumerable FindAll()
{
using(IServiceFactory factory = new ServiceFactory(this.DirectoryPath))
{
ILogger logger = factory.Create();
try
{
using(IRepository repository = factory.Create(this.ConstructorImports))
{
List items = repository.FindAll(null).ToList();
return items;
}
} catch (Exception ex)
{
logger.LogError("Error when retrieving items.", ex);
return new List();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment