コード例 #1
0
 public Task<ISubscriptionTrackingService> CreateSubscriptionTrackingService(
     SubscriptionTrackingElement configuration)
 {
     var path = configuration.GetString("path");
     var fsTrackingBaseDir = new DirectoryInfo(GetRootedPath(path));
     var fsTrackingService = new FilesystemSubscriptionTrackingService(fsTrackingBaseDir);
     fsTrackingService.Init();
     return Task.FromResult<ISubscriptionTrackingService>(fsTrackingService);
 }
コード例 #2
0
 public async Task<ISubscriptionTrackingService> CreateSubscriptionTrackingService(
     SubscriptionTrackingElement configuration)
 {
     var path = configuration.GetString("path");
     var sqliteBaseDir = new DirectoryInfo(GetRootedPath(path));
     var sqliteSubscriptionTrackingService = new SQLiteSubscriptionTrackingService(sqliteBaseDir);
     await sqliteSubscriptionTrackingService.Init();
     return sqliteSubscriptionTrackingService;
 }
コード例 #3
0
        public static Task<ISubscriptionTrackingService> InitSubscriptionTrackingService(
            SubscriptionTrackingElement config)
        {
            var providerName = config.Provider;
            ISubscriptionTrackingServiceProvider provider;
            if (string.IsNullOrWhiteSpace(providerName))
            {
                Log.Debug("No subscription tracking service provider specified; using default provider...");
                provider = new FilesystemServicesProvider();
            }
            else
            {
                provider = ProviderHelper.GetProvider<ISubscriptionTrackingServiceProvider>(providerName);
            }

            Log.Debug("Initializing subscription tracking service...");
            return provider.CreateSubscriptionTrackingService(config);
        }
コード例 #4
0
        public async Task<ISubscriptionTrackingService> CreateSubscriptionTrackingService(
            SubscriptionTrackingElement configuration)
        {
            var connectionName = configuration.GetString("connectionName");
            if (string.IsNullOrWhiteSpace(connectionName))
            {
                throw new ConfigurationErrorsException(
                    "Attribute 'connectionName' is required for SQL subscription tracking service");
            }

            var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionName];
            if (connectionStringSettings == null)
            {
                throw new ConfigurationErrorsException("Connection string settings \"" + connectionName + "\" not found");
            }
            var sqlSubscriptionTrackingService = new SQLSubscriptionTrackingService(connectionStringSettings);
            await sqlSubscriptionTrackingService.Init();
            return sqlSubscriptionTrackingService;
        }
コード例 #5
0
 public Task<ISubscriptionTrackingService> CreateSubscriptionTrackingService(
     SubscriptionTrackingElement configuration)
 {
     return Task.FromResult<ISubscriptionTrackingService>(new InMemorySubscriptionTrackingService());
 }