Commits

Mike Podonyi  committed 15959f6

Prototyping FileRessource and DIContainer stuff

  • Participants
  • Parent commits 1e20a6c

Comments (0)

Files changed (2)

File src/Empi.Camino/Empi.Camino.csproj

     <Compile Include="Web\Data\ItemStateWrapper.cs" />
     <Compile Include="Web\Data\NoCacheStateWrapper.cs" />
     <Compile Include="Web\Data\SessionStateWrapper.cs" />
+    <Compile Include="Web\IFileResource.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="Retailer.dbml">

File src/Empi.Camino/Web/IFileResource.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
+{
+
+    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;
+        }
+
+
+
+
+
+    
+
+    
+    }
+
+}