Commits

Mike Podonyi committed cd75ac6

move DIContainer in own File; add a file Prototyping for exact this purpose

Comments (0)

Files changed (4)

src/Empi.Camino/DIContainer.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Practices.Unity;
+using Empi.Camino.Web.Data;
+using Empi.Camino.Web;
+
+namespace Empi.Camino
+{
+    internal class DIContainer
+    {
+        private IUnityContainer _DIContainer = new UnityContainer();
+
+        private DIContainer()
+        {
+            Initialize();
+        }
+
+
+        internal static DIContainer GetDIContainer()
+        {
+            return DataStoreFactory.GetApplicationDataStore.LazyGet<DIContainer>("DIContainer", () => new DIContainer());
+        }
+
+        private void Initialize()
+        {
+            //MP: mache eine tabelle {Baseclass, Class, Name}
+            //MP: initialize from DataBase
+
+            _DIContainer.RegisterType(typeof(IFileResourceProvider), typeof(LocalResourceProvider), "local");
+        }
+
+        public T Resolve<T>(string name)
+        {
+            return _DIContainer.Resolve<T>(name);
+        }
+
+    }
+}

src/Empi.Camino/Empi.Camino.csproj

     <Compile Include="ConnectionsStrings.cs" />
     <Compile Include="Data\DataContextFactory.cs" />
     <Compile Include="Data\IDataContextFactory.cs" />
+    <Compile Include="DIContainer.cs" />
+    <Compile Include="Prototyping.cs" />
     <Compile Include="Web\Data\ApplicationStateWrapper.cs" />
     <Compile Include="Web\Data\CacheStateWrapper.cs" />
     <Compile Include="Web\Data\DataStore.cs" />

src/Empi.Camino/Prototyping.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using Empi.Camino.Web.Data;
+using Microsoft.Practices.Unity;
+
+namespace Empi.Camino.Web
+{
+    interface IFileResource
+    {
+        string AbsoluteUrl
+        { get; }
+
+        string Id
+        { get; }
+    }
+
+    internal class FileResource : IFileResource
+    {
+        internal FileResource(string id, IFileResourceProvider fileResourceProvider)
+        {
+            _fileResourceProvider = fileResourceProvider;
+        }
+
+        private IFileResourceProvider _fileResourceProvider;
+
+
+        #region IFileResource Members
+
+        public string AbsoluteUrl
+        {
+            get { throw new NotImplementedException(); }
+        }
+
+        public string Id
+        {
+            get { throw new NotImplementedException(); }
+        }
+
+        #endregion
+    }
+
+    interface IFileResourceProvider
+    {
+        string GetAbsoluteUrl(string id);
+    }
+
+    //internal class S3ResourceProvider : IFileResourceProvider
+    //{ 
+
+
+    //}
+
+    internal class LocalResourceProvider : IFileResourceProvider
+    {
+
+
+        #region IFileResourceProvider Members
+
+        public string GetAbsoluteUrl(string id)
+        {
+            throw new NotImplementedException();
+        }
+
+        #endregion
+    }
+
+
+
+    internal class FileResourceFactory
+    {
+
+        private FileResourceFactory()
+        { }
+
+        internal static FileResourceFactory GetFileResourceFactory()
+        {
+            return new FileResourceFactory();
+        }
+
+
+
+        //MP: {FileRessourceId,FileRessourceProviderName}
+
+
+
+        private IFileResourceProvider GetFileRessourceProvider(string providerName)
+        {
+            return DIContainer.GetDIContainer().Resolve<IFileResourceProvider>(providerName);
+        }
+
+
+        internal IFileResource GetFileRessource(string id)
+        {
+            return null;
+        }
+
+        internal IFileResource SaveFileRessource(string id, Stream fileStream)
+        {
+            return null;
+        }
+
+
+
+
+
+
+
+
+    }
+
+}

src/Empi.Camino/Web/IFileResource.cs

 using Empi.Camino.Web.Data;
 using Microsoft.Practices.Unity;
 
-namespace Empi.Camino
+namespace Empi.Camino.Web
 {
 
-    internal class DIContainer
-    { 
-        private IUnityContainer _DIContainer = new UnityContainer();
-
-        private DIContainer()
-        {
-            Initialize();
-        }
-
-
-        internal static DIContainer GetDIContainer()
-        {
-            return DataStoreFactory.GetApplicationDataStore.LazyGet<DIContainer>("DIContainer", () => new DIContainer());
-        }
-
-        private void Initialize()
-        { 
-            //MP: mache eine tabelle {Baseclass, Class, Name}
-            //MP: initialize from DataBase
-            
-
-        
-        
-        
-        }
-
-        public T Resolve<T>(string name)
-        {
-            return _DIContainer.Resolve<T>(name);
-        }
-    
-    }
-
-
 }
-
-namespace Empi.Camino.Web
-{
-    interface IFileResource
-    {
-        string AbsoluteUrl
-        { get; }
-
-        string Id
-        { get; }
-    }
-
-    internal class FileResource : IFileResource
-    {
-        internal FileResource(IFileResourceProvider fileResourceProvider)
-        {
-            _fileResourceProvider = fileResourceProvider;
-        }
-
-        private IFileResourceProvider _fileResourceProvider;
-
-
-        #region IFileResource Members
-
-        public string AbsoluteUrl
-        {
-            get { throw new NotImplementedException(); }
-        }
-
-        public string Id
-        {
-            get { throw new NotImplementedException(); }
-        }
-
-        #endregion
-    }
-    
-    interface IFileResourceProvider
-    {
-        string GetAbsoluteUrl(string id);
-    }
-
-    //internal class S3ResourceProvider : IFileResourceProvider
-    //{ 
-    
-    
-    //}
-
-    internal class LocalResourceProvider : IFileResourceProvider
-    {
-
-
-        #region IFileResourceProvider Members
-
-        public string GetAbsoluteUrl(string id)
-        {
-            throw new NotImplementedException();
-        }
-
-        #endregion
-    }
-
-
-
-    internal class FileResourceFactory
-    {
-
-        private FileResourceFactory()
-        { }
-
-        internal static FileResourceFactory GetFileResourceFactory()
-        {
-            return new FileResourceFactory();
-        }
-
-
-        
-        //MP: {FileRessourceId,FileRessourceProviderName}
-        
-
-
-        private IFileResourceProvider GetFileRessourceProvider(string providerName)
-        {
-            return DIContainer.GetDIContainer().Resolve<IFileResourceProvider>(providerName);
-        }
-
-
-        internal IFileResource GetFileRessource(string id)
-        {
-            return null;
-        }
-
-        internal IFileResource SaveFileRessource(string id, Stream fileStream)
-        {
-            return null;
-        }
-
-
-
-
-
-    
-
-    
-    }
-
-}