Search code examples
sql-serverweb-servicescompact-frameworkcompact-framework2.0

Display latest inserted data in .NET Compact Framework application


I am developing application which should be compatible with Window CE 4.x and above version. So, I decided to select .NET compact Framework 2.0 for development option.

But now I have situation that I am not able to find any proper solution for my below requirement.

Requirement;

My application requirement is to display information of database table in application via Web service.

Problem:

Here information in table is dynamic and it will be inserted inserted every few seconds/minutes and .NET CF application should be display latest (last 4 or configured N) information.

I am thinking to implement pull technology in application where application will do web service call every 2/5 seconds or few minutes but this approach is not looking good as it will increase the unnecessary service call as it is possible that new information inserted after some minutes.

So, I am thinking to use push technology in application where server will send notification to .NET compact framework application (client) on new record insert in database table. Notification has message with primary key of record so, .NET compact framework application will call web service method with primary key on push notification from server and display information in application.

Above push technology approach is looking easy with words but I don't have an idea about it's implementation.

I tried to search solution/example for same on internet but could not able find.

Can anyone help me on push technology approach ? How I can implement it in my application?


Solution

  • I implemented below solution to get latest inserted data in .net compact framework application.

    • I created windows service application which hosted on windows server and watch the SQL server database table to get the notification on new record insert. For this I have used TableDependency Library
    • This window service also start TCP server (IP Address & Port)
    • Now once new data inserted in SQL server table, Window service application will get the notification in SqlTableDependency.OnChange event and new record insert data message will be send to all the connected client (Windows CE Application) to the TCP Server.