From 9f929e8f1260aabae4903466f76d2fce081107a6 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 24 Aug 2013 14:52:38 -0400 Subject: [PATCH] add service locator interface --- Blarg.GameFramework/Blarg.GameFramework.csproj | 1 + Blarg.GameFramework/IServiceLocator.cs | 11 +++++++++++ Blarg.GameFramework/ServiceContainer.cs | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Blarg.GameFramework/IServiceLocator.cs diff --git a/Blarg.GameFramework/Blarg.GameFramework.csproj b/Blarg.GameFramework/Blarg.GameFramework.csproj index 610c342..4ac0281 100644 --- a/Blarg.GameFramework/Blarg.GameFramework.csproj +++ b/Blarg.GameFramework/Blarg.GameFramework.csproj @@ -179,6 +179,7 @@ + diff --git a/Blarg.GameFramework/IServiceLocator.cs b/Blarg.GameFramework/IServiceLocator.cs new file mode 100644 index 0000000..567f6b8 --- /dev/null +++ b/Blarg.GameFramework/IServiceLocator.cs @@ -0,0 +1,11 @@ +using System; + +namespace Blarg.GameFramework +{ + public interface IServiceLocator + { + T Get() where T : class; + object Get(Type type); + } +} + diff --git a/Blarg.GameFramework/ServiceContainer.cs b/Blarg.GameFramework/ServiceContainer.cs index 38dcb26..8cf5a22 100644 --- a/Blarg.GameFramework/ServiceContainer.cs +++ b/Blarg.GameFramework/ServiceContainer.cs @@ -4,7 +4,7 @@ using Blarg.GameFramework.Support; namespace Blarg.GameFramework { - public class ServiceContainer : IDisposable + public class ServiceContainer : IServiceLocator, IDisposable { const string LOG_TAG = "SERVICES";