public CategoryRepository(myAppContext context) { _context = context; }
public async Task InvokeAsync(HttpContext context, chatClientBuffer chatClientBuffer, myAppContext connectionContext) { if (context.Request.Path == "/Chat") { if (context.WebSockets.IsWebSocketRequest) { using (WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync()) { IdbConnector con = new sqlConnector(); con.init(connectionContext); await Handler(context, webSocket, chatClientBuffer, con); } } else { context.Response.StatusCode = 400; await context.Response.WriteAsync("ChatPage"); } } else { await _next.Invoke(context); } }
/// <summary> /// инициализация подключения /// </summary> /// <param name="param"></param> public void init(object param) { db = (myAppContext)param; }