DataServicePaxosProxy(string resourceManaged, string resourcePrestented, ProxyStateMachine stateMachine)
            : base(resourceManaged, resourcePrestented, stateMachine.ServiceName)
        {
            var serviceName = stateMachine.ServiceName;
            this.stateMachine = stateMachine;
            this.stateMachine.GetResponse = base.GetResponse;

            RouteTable.Routes.Add(new Route(serviceName + "/{*path}", new FuncRouteHandler(_ => this)));
        }
        public static ProxyBase New(string kind, ProxyStateMachine stateMachine)
        {
            if (kind.Equals("AzureStorage", StringComparison.InvariantCultureIgnoreCase))
            {
                return AzureStorageProxy.New(stateMachine);
            }

            if (kind.Equals("DataService", StringComparison.InvariantCultureIgnoreCase))
            {
                return DataServicePaxosProxy.New(stateMachine);
            }

            throw new ArgumentOutOfRangeException(kind + " is not a known service type");
        }
        AzureStorageProxy(string resourcePresented, ProxyStateMachine stateMachine)
            : base(resourcePresented, stateMachine.ServiceName)
        {
            var serviceName = stateMachine.ServiceName;
            this.stateMachine = stateMachine;
            this.stateMachine.GetResponse = base.GetResponse;
            this.ManagedAccount = RoleEnvironment.GetConfigurationSettingValue(serviceName + ".StorageAccount");
            this.ManagedKey = RoleEnvironment.GetConfigurationSettingValue(serviceName + ".StorageKey");
            this.PresentedAccount = RoleEnvironment.GetConfigurationSettingValue(serviceName + ".PresentedAccount");
            this.PresentedKey = RoleEnvironment.GetConfigurationSettingValue(serviceName + ".PresentedKey");
            this.prefix = serviceName;
            this.stateMachine = stateMachine;

            RouteTable.Routes.Add(new Route(serviceName + "/{*path}", new FuncRouteHandler(_ => this)));
        }
 public static DataServicePaxosProxy New(ProxyStateMachine stateMachine)
 {
     var resourcePresented = RoleEnvironment.GetConfigurationSettingValue(stateMachine.ServiceName + ".ResourcePresented");
     var resourceManaged = RoleEnvironment.GetConfigurationSettingValue(stateMachine.ServiceName + ".ResourceManaged");
     return new DataServicePaxosProxy(resourceManaged, resourcePresented, stateMachine);
 }
 public static AzureStorageProxy New(ProxyStateMachine stateMachine)
 {
     var resource = RoleEnvironment.GetConfigurationSettingValue(stateMachine.ServiceName + ".ResourcePresented");
     return new AzureStorageProxy(resource, stateMachine);
 }