예제 #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);
     }
 }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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);
     }
 }
예제 #5
0
 public OwinHost() {
     _hostContext = new OwinHostContext(OwinFactory.CreateEnvironment());
     _state = OwinHostState.ConfigureHost;
 }
예제 #6
0
 public OwinHost()
 {
     _hostContext = new OwinHostContext(OwinFactory.CreateEnvironment());
     _state       = OwinHostState.ConfigureHost;
 }