Example #1
0
 public UploadController(IDataSetSchemaService dataSetSchemaService,
                         IDataSetDetailService dataSetDetailService,
                         ICategoryService categoryService,
                         IDataSetDetailUploaderService uploaderService, ISystemConfigurationService systemConfigurationService)
     : base(systemConfigurationService, categoryService)
 {
     _dataSetSchemaService = dataSetSchemaService;
     _dataSetDetailService = dataSetDetailService;
     _categoryService      = categoryService;
     _uploaderService      = uploaderService;
 }
Example #2
0
        private static void InitialiseDatabase()
        {
            // Setup StructureMap to determine the concrete repository pattern to use.
            ObjectFactory.Initialize(
                x =>
            {
                x.For <IUnitOfWorkFactory>().Use <EFUnitOfWorkFactory>();
                x.For(typeof(IRepository <>)).Use(typeof(Repository <>));
                x.For <ISqlTableUtility>().Use <SqlTableUtility>();
                x.For <IDataSetSchemaDefinitionService>().Use <DataSetSchemaDefinitionService>();
                x.For <IDataSetDetailSqlRepo>().Use <DataSetDetailSqlRepo>();
                x.For <ISystemConfigurationService>().Use <SystemConfigurationService>();
                x.For <ICacheProvider>().Use <HttpCache>();
                x.For <IDataSetDetailCsvProcessor>().Use <DataSetDetailCsvProcessor>();
                x.For <IDataSetSchemaService>().Use <DataSetSchemaService>();
            }
                );


            // Select an Entity Framework model to use with the factory.
            EFUnitOfWorkFactory.SetObjectContext(() => new DataShareContext());

            //Never recreate the database
            Database.SetInitializer <DataShareContext>(null);



            //initialise all services
            _dataSetSchemaService = new DataSetSchemaService(
                ObjectFactory.GetInstance <IRepository <DataSetSchema> >()
                , ObjectFactory.GetInstance <DataSetSchemaDefinitionService>()
                , ObjectFactory.GetInstance <IRepository <DataSetDetail> >()
                , ObjectFactory.GetInstance <ISqlTableUtility>());

            _uploaderService = new DataSetDetailUploaderService(
                _dataSetSchemaService
                , ObjectFactory.GetInstance <IRepository <DataSetDetail> >()
                , ObjectFactory.GetInstance <IDataSetDetailCsvProcessor>()
                , ObjectFactory.GetInstance <IDataSetDetailSqlRepo>());

            _debugInfoService = new DebugInfoService(ObjectFactory.GetInstance <IRepository <DebugInfo> >());
        }