Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

output doesn't get result

$
0
0

i have this project i don't have any error why i don't get any result from db?

WebService1.asmx

using FireSharp.Config;
using FireSharp.Interfaces;
using FireSharp.Response;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using PushSharp;
using System.Net;
using System.Web.Script.Serialization;
using System.Text;
using System.IO;
using System.Data.SqlClient;
using System.Web.Services.Description;
using System.Data;
using System.Security.Permissions;
using Microsoft.Xrm.Sdk;
using TableDependency.SqlClient.Base.EventArgs;
using TableDependency.SqlClient.Base.Enums;
using ChangeType = TableDependency.SqlClient.Base.Enums.ChangeType;
using TableDependency.SqlClient;

namespace firebase_service
{
  
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class WebService1 : System.Web.Services.WebService
    {

        [WebMethod]
        public void new_function()
        {


            var connectionString = "data source=.; initial catalog=TBNotify2;uid=sa4;pwd=123";
            using (var tableDependency = new SqlTableDependency<Customer>(connectionString, "Customers"))
            {

                tableDependency.OnChanged += TableDependency_Changed;

                tableDependency.Start();

                HttpContext.Current.Response.ContentType = "application/json";
                // Console.ReadKey();
                HttpContext.Current.Response.Write("Waiting for receiving notifications...");
                HttpContext.Current.Response.Write(Environment.NewLine);
                HttpContext.Current.Response.Write("Press a Key to Stop");

                tableDependency.Stop();

            }

          

        }


        static void TableDependency_Changed(object sender, RecordChangedEventArgs<Customer> e)
        {

            HttpContext.Current.Response.Write(Environment.NewLine);

            if (e.ChangeType != ChangeType.None)
            {

                var changedEntity = e.Entity;

            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write("DML operation: " + e.ChangeType);
                HttpContext.Current.Response.Write("ID: " + changedEntity.Id);
                HttpContext.Current.Response.Write("Name: " + changedEntity.Name);
                HttpContext.Current.Response.Write(Environment.NewLine);

            }
        }




    }
}

Customer.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace firebase_service
{
    public class Customer
    {

        public int Id { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }

        public string City { get; set; }
        public DateTime Born { get; set; }


      

    }


}

table name is Customers


CREATE TABLE [dbo].[Customers](
[Id] [bigint] NULL,
[Name] [varchar](50) NULL,
[Surname] [varchar](50) NULL
) ON [PRIMARY]

GO


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>