Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ChacoBot.Storage;
- using ChacoBot.Storage.Implementations;
- using Unity;
- using Unity.Resolution;
- namespace ChacoBot
- {
- public static class Unity
- {
- private static UnityContainer _container;
- public static UnityContainer Container
- {
- get
- {
- if(_container == null)
- RegisterTypes();
- return _container;
- }
- }
- public static void RegisterTypes()
- {
- _container = new UnityContainer();
- _container.RegisterType<IDataStorage, InMemoryStorage>();
- }
- public static T Resolve<T>()
- {
- return (T)Container.Resolve(typeof(T), string.Empty, new CompositeResolverOverride());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement