Esempio n. 1
0
        public SqlNotificationDependency()
        {
            ConnectToSQL cts = new ConnectToSQL();

            cts.Connect(Config.ConnectionStringEDP, 1433, "f");
            string ConnectionString = $"Server={Config.ConnectionStringEDP},1433; initial catalog = chat_container; user id = SqlUser; password = SqlUserSt0rongP@assord";
            SqlTableDependency <ChatsC> myDependencyTableDependency;

            try
            {
                myDependencyTableDependency = new SqlTableDependency <ChatsC>(ConnectionString, cts.GetServerListChannelData(0).FirstOrDefault().Name);

                myDependencyTableDependency.OnError += (o, args) => this.ErrorNotification(o, args);

                myDependencyTableDependency.OnChanged += (o, args) => this.OutputNotification(args.ChangeType, args.Entity);

                myDependencyTableDependency.Start();
            }
            catch
            { }
        }