Thank you for contacting us.
Regarding your question of the correct way to dispose a DataAccess context - in your case most probably only disposing the context will be the best solution. Like this:
Calling 'DisposeDatabase' disposes the underlying static Database instance. This means that the next time you try to perform any OpenAccess operation the entire metadata will be recalculated. This is an expensive operation and ideally should be performed only once, on the first operation.
Also from your example it seams that you are registering in the IoC container a specific instance of your repository that will always be returned when resolving IGroupRepository. This specific instance holds a specific instance of the OpenAccessContext. This means that if somewhere in your code you dispose your repository, its OpenAccessContext instance will also be disposed and every next time you resolve from the IoC container the repository it will be already disposed and will be working inside with a disposed instance of the OpenAccessContext.
For that reason I would recommend that you register in the IoC container just the repository type and all its dependencies and always resolve a new instance of your repository and the context it is using. You can do this by registering your own OpenAccessContext class (named for example DataContext) like it is shown here
After that you can make you your repository depend on your custom context like this:
And you can register in the Simple Injector container both types like this:
I hope you find this information helpful.
Check out the latest announcement
about Telerik Data Access vNext as a powerful framework
able to solve core development problems.