/// <summary>
        /// See <see cref="Feature.Setup"/>
        /// </summary>
        protected override void Setup(FeatureConfigurationContext context)
        {
            //TODO: get rid of these statics
            SubscriptionServiceContext.SubscriptionTableName = context.Settings.Get <string>("AzureSubscriptionStorage.TableName");
            SubscriptionServiceContext.CreateIfNotExist      = context.Settings.Get <bool>("AzureSubscriptionStorage.CreateSchema");

            var account = CloudStorageAccount.Parse(context.Settings.Get <string>("AzureSubscriptionStorage.ConnectionString"));

            SubscriptionServiceContext.Init(account.CreateCloudTableClient());

            context.Container.ConfigureComponent(() => new AzureSubscriptionStorage(account), DependencyLifecycle.InstancePerCall);
        }
示例#2
0
        /// <summary>
        /// Configures the storage with the user supplied persistence configuration
        /// Azure tables are created if requested by the user
        /// </summary>
        /// <param name="config"></param>
        /// <param name="connectionString"></param>
        /// <param name="createSchema"></param>
        /// <param name="tableName"> </param>
        /// <returns></returns>
        public static Configure AzureSubscriptionStorage(this Configure config,
                                                         string connectionString,
                                                         bool createSchema,
                                                         string tableName)
        {
            SubscriptionServiceContext.SubscriptionTableName = tableName;
            SubscriptionServiceContext.CreateIfNotExist      = createSchema;

            var account = CloudStorageAccount.Parse(connectionString);

            SubscriptionServiceContext.Init(account.CreateCloudTableClient());

            config.Configurer.ConfigureComponent(() => new AzureSubscriptionStorage(account), DependencyLifecycle.InstancePerCall);

            return(config);
        }