예제 #1
0
        private StockTicker(IHubConnectionContext <dynamic> clients)
        {
            Clients = clients;

            var mapper = new ModelToTableMapper <Stock>();

            mapper.AddMapping(s => s.Symbol, "Code");

            _tableDependency = new SqlTableDependency <Stock>(
                ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString,
                "Stocks", mapper.ToString());

            _tableDependency.OnChanged += SqlTableDependency_Changed;
            _tableDependency.OnError   += SqlTableDependency_OnError;
            _tableDependency.Start();
        }