Exemple #1
0
        public AzureFunctionsFabric(
            ISerializerFactorySelector serializerFactorySelector,
            INumericIdGenerator idGenerator,
            ITransitionRunner transitionRunner,
            IAzureWebJobsEnviromentalSettings azureWebJobsEnviromentalSettings,
            ICloudStorageAccountFactory cloudStorageAccountFactory,
            AzureFunctionsFabricSettings settings,
            IServiceProxyBuilder serviceProxyBuilder,
            IRoutineMethodResolver routineMethodResolver,
            IMethodInvokerFactory methodInvokerFactory,
            IServiceRegistry serviceRegistry)
        {
            _transitionRunner      = transitionRunner;
            _idGenerator           = idGenerator;
            _settings              = settings;
            _serviceProxyBuilder   = serviceProxyBuilder;
            _routineMethodResolver = routineMethodResolver;
            _methodInvokerFactory  = methodInvokerFactory;
            _serviceRegistry       = serviceRegistry;

#warning Need configurable serializer
            // Hard-code this for now.
            _defaultSerializer = serializerFactorySelector.Select("dasyncjson").Create();

            _storageAccountConnectionString = azureWebJobsEnviromentalSettings.DefaultStorageConnectionString;
            _storageAccount = cloudStorageAccountFactory.Create(_storageAccountConnectionString);

            //#warning make sure that site name is alpha-numeric and does not start with a number
            //            var prefix = azureWebJobsEnviromentalSettings.WebSiteName.ToLowerInvariant();
            var prefix = "";
            _routinesTable = _storageAccount.TableClient.GetTableReference(prefix + "routines");
            _servicesTable = _storageAccount.TableClient.GetTableReference(prefix + "services");
        }
Exemple #2
0
        public AzureStorageServiceRepository(
            ICloudStorageAccountFactory cloudStorageAccountFactory,
            IAzureWebJobsEnviromentalSettings azureWebJobsEnviromentalSettings)
        {
            var accountNames = new HashSet <string>();

            var defaultAccountName = ConnectionStringParser.GetAccountName(
                azureWebJobsEnviromentalSettings.DefaultStorageConnectionString);

            accountNames.Add(defaultAccountName);

            var defaultStorageAccount = cloudStorageAccountFactory.Create(
                azureWebJobsEnviromentalSettings.DefaultStorageConnectionString);
            var registryTable = defaultStorageAccount.TableClient.GetTableReference("registry");

            _registryTables.Add(registryTable);

            foreach (var setting in azureWebJobsEnviromentalSettings.GetAllSettings())
            {
                if (!setting.Key.EndsWith("_STORAGE"))
                {
                    continue;
                }

                var connectionString = setting.Value;
                var accountName      = ConnectionStringParser.GetAccountName(connectionString);
                if (!accountNames.Add(accountName))
                {
                    continue;
                }

                var storageAccount = cloudStorageAccountFactory.Create(connectionString);
                registryTable = storageAccount.TableClient.GetTableReference("registry");
                _registryTables.Add(registryTable);
            }
        }
 public StorageAccontConnectionStringResolver(
     IAzureWebJobsEnviromentalSettings azureWebJobsEnviromentalSettings)
 {
     _azureWebJobsEnviromentalSettings = azureWebJobsEnviromentalSettings;
 }