protected virtual void RegisterComponents( )
        {
            For <IConnectionStringProvider> ( ).Use <ConnectionStringProvider> ( );
            For <DbSchemaProvider> ( ).Use <StorageDbSchemaProvider> ( ); //default constructor
            For <IDatabaseFactory> ( ).Use <SqlDatabaseFactory> ( );
            For <ISortingStrategyFactory> ( ).Use <SortingStrategyFactory> ( );
            For <ObjectArchieveDataAdapter> ( ).Use <ObjectArchieveDataAdapter> ( );
            For <IObjectArchieveDataAccess> ( ).Use <ObjectArchieveDataAccess> ( );

            IRetrieveUrlProvider urlProvider = new RetrieveUrlProvider(CloudConfigurationManager.GetSetting(RetrieveUrlProvider.config_WadoRs_API_URL),
                                                                       CloudConfigurationManager.GetSetting(RetrieveUrlProvider.config_WadoUri_API_URL));

            For <IDCloudCommandFactory> ( ).Use <DCloudCommandFactory> ( );

            For <IObjectArchieveQueryService> ( ).Use <ObjectArchieveQueryService> ( );
            For <IObjectStoreService>         ( ).Use <ObjectStoreService>         ( );
            For <IObjectRetrieveService>      ( ).Use <ObjectRetrieveService>      ( );

            For <IWadoRsService>         ( ).Use <WadoRsService>         ( );
            For <IWebObjectStoreService> ( ).Use <WebObjectStoreService> ( );
            For <IQidoRsService>         ( ).Use <QidoRsService>         ( );
            For <IWadoUriService>        ( ).Use <WadoUriService>        ( );
            For <IOhifService>           ( ).Use <OhifService>           ( );

            For <IDicomMediaIdFactory> ( ).Use <DicomMediaIdFactory> ( );

            For <IRetrieveUrlProvider> ( ).Use(urlProvider);

            RegisterStoreCommandSettings( );

            if (StorageConection.StartsWith("|datadirectory|", StringComparison.OrdinalIgnoreCase))
            {
                var appDataPath  = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                var lastIndex    = StorageConection.IndexOf('|', 1);
                var userPathPart = StorageConection.Substring(lastIndex + 1);


                StorageConection = appDataPath + userPathPart;
            }

            if (System.IO.Path.IsPathRooted(StorageConection))
            {
                For <IKeyProvider> ( ).Use <HashedFileKeyProvider> ( );
                For <IMediaStorageService> ( ).Use <FileStorageService> ( ).Ctor <string> ( ).Is(StorageConection);
            }
            else
            {
                StorageAccount = CloudStorageAccount.Parse(StorageConection);

                AzureStorageSupported = true;

                For <CloudStorageAccount> ( ).Use(@StorageAccount);

                For <IMediaStorageService> ( ).Use <AzureStorageService> ( ).Ctor <CloudStorageAccount> ( ).Is(StorageAccount);
            }
        }
示例#2
0
        protected virtual void RegisterComponents( )
        {
            For <DbSchemaProvider> ( ).Use <StorageDbSchemaProvider> ( ); //default constructor

            For <IDCloudCommandFactory> ( ).Use <DCloudCommandFactory> ( );

            For <IObjectArchieveQueryService> ( ).Use <ObjectArchieveQueryService> ( );
            For <IObjectStoreService>         ( ).Use <ObjectStoreService>         ( );
            For <IObjectRetrieveService>      ( ).Use <ObjectRetrieveService>      ( );

            For <IWadoRsService>         ( ).Use <WadoRsService>         ( );
            For <IWebObjectStoreService> ( ).Use <WebObjectStoreService> ( );
            For <IQidoRsService>         ( ).Use <QidoRsService>         ( );
            For <IWadoUriService>        ( ).Use <WadoUriService>        ( );

            For <IObjectStorageDataAccess> ( ).Use(@DataAccess);
            For <IObjectStorageQueryDataAccess> ( ).Use(@DataAccess);

            For <IDicomMediaIdFactory> ( ).Use <DicomMediaIdFactory> ( );

            if (StorageConection.StartsWith("|datadirectory|", StringComparison.OrdinalIgnoreCase))
            {
                var appDataPath  = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                var lastIndex    = StorageConection.IndexOf('|', 1);
                var userPathPart = StorageConection.Substring(lastIndex + 1);


                StorageConection = appDataPath + userPathPart;
            }

            if (System.IO.Path.IsPathRooted(StorageConection))
            {
                For <IMediaStorageService> ( ).Use <FileStorageService> ( ).Ctor <string> ( ).Is(StorageConection);
            }
            else
            {
                StorageAccount = CloudStorageAccount.Parse(StorageConection);

                AzureStorageSupported = true;

                For <CloudStorageAccount> ( ).Use(@StorageAccount);

                For <IMediaStorageService> ( ).Use <AzureStorageService> ( ).Ctor <CloudStorageAccount> ( ).Is(StorageAccount);
            }
        }