Esempio n. 1
0
 public void SetApp(AppFunc appFunc) {
     switch (_state) {
         case OwinHostState.ConfigureHost:
             throw new Exception("The Server must be specified before setting the AppFunc.");
         case OwinHostState.ConfigureApp:
             _server.SetAppFunc(appFunc);
             _state = OwinHostState.Runnable;
             return;
         case OwinHostState.Runnable:
             throw new Exception("The AppFunc may only be set once.");
         default:
             throw new ArgumentOutOfRangeException("Unknown Host State: " + _state);
     }
 }
Esempio n. 2
0
        public void SetServer(IOwinServer server)
        {
            switch (_state)
            {
            case OwinHostState.ConfigureHost:
                _server = server;
                _server.Configure(new OwinHostContext(_hostContext.Environment));
                _state = OwinHostState.ConfigureApp;
                return;

            case OwinHostState.ConfigureApp:
            case OwinHostState.Runnable:
                throw new Exception("The Server may only be set once.");

            default:
                throw new ArgumentOutOfRangeException("Unknown Host State: " + _state);
            }
        }
Esempio n. 3
0
        public void SetApp(AppFunc appFunc)
        {
            switch (_state)
            {
            case OwinHostState.ConfigureHost:
                throw new Exception("The Server must be specified before setting the AppFunc.");

            case OwinHostState.ConfigureApp:
                _server.SetAppFunc(appFunc);
                _state = OwinHostState.Runnable;
                return;

            case OwinHostState.Runnable:
                throw new Exception("The AppFunc may only be set once.");

            default:
                throw new ArgumentOutOfRangeException("Unknown Host State: " + _state);
            }
        }
Esempio n. 4
0
 public void SetServer(IOwinServer server) {
     switch (_state) {
         case OwinHostState.ConfigureHost:
             _server = server;
             _server.Configure(new OwinHostContext(_hostContext.Environment));
             _state = OwinHostState.ConfigureApp;
             return;
         case OwinHostState.ConfigureApp:
         case OwinHostState.Runnable:
             throw new Exception("The Server may only be set once.");
         default:
             throw new ArgumentOutOfRangeException("Unknown Host State: " + _state);
     }
 }
Esempio n. 5
0
 public OwinHost() {
     _hostContext = new OwinHostContext(OwinFactory.CreateEnvironment());
     _state = OwinHostState.ConfigureHost;
 }
Esempio n. 6
0
 public OwinHost()
 {
     _hostContext = new OwinHostContext(OwinFactory.CreateEnvironment());
     _state       = OwinHostState.ConfigureHost;
 }