services.AddSingleton<IDatabaseService, DatabaseServiceImpl>(); // ... public class ChatHub : Hub { public Task SendMessage(string user, string message, IDatabaseService dbService) { var userName = dbService.GetUserName(user); return Clients.All.SendAsync("ReceiveMessage", userName, message); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter