Offline Application Block


The Smart Client Offline Application Block is now live on MSDN.



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/offline.asp


This block has re-usable code and samples which show how you can build smart client applications which can operate offline. With this block your application can detect the presence or absence of a network connection, cache data for use while offline, and re-synchronize data and tasks with the network once the application goes online.



The block uses a store and forward mechanism which is suitable for message-based interactions with the network, such as you would get with a smart client operating in a service oriented environment. This is a very flexible model and doesn’t require the kind of tight integration between client and server you find with database merge-replication approaches to offline…

Comments (8)

  1. Hows does the block detect the presence or absence of a network connection?

  2. ScottWater says:

    The Smart Client Offline Application Block is now live on MSDN.

  3. Paul Tyng says:

    Greg,

    I downloaded the block last night and was reading through the documentation, I beleive it said that the developer will need to implement that specific piece (online / offline detection). It looks to me to be a much more involved wrapper to the caching application block that queue’s up actions for re-connection, etc. I may be wrong but that was my inital take on it.

    Paul Tyng

  4. Paul Tyng says:

    I’m not entirely correct, what I was reading about was the custom detection, the block comes with a default implementation of connection detection:

    "The default connection detection provider uses the InternetGetConnectedState method of the WinInet dynamic-link library (DLL) to detect connection state changes. For example, if you remove the network cable from a computer that is connected to the network while running the sample, the connection state displays the change to offline mode."

    [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/offline-ch03.asp]

  5. David Hill says:

    Yes – the block includes a default implementation which tells you whether there is a network connection or not. This may suffice for simple cases but, in general, you may want to implement something more suitable for your application.

    Having a network connection is a necessary but not sufficient condition to being online. Even with a network connection you can’t be sure that the service you are trying to get to is available – if the service is not available, you are essentially offline despite being connected to the network.

    Using the pluggable architecture of the block, you can implement a more meaningful offline state detection mechanism. For instance, you could periodically ping the required service, though arguably this is pretty inefficient and inelegant.

  6. Last month Microsoft released a new application block. This application block of re-usable code and samples, can be used to model your own applications to allow them to detect the presence or absence of a network connection, cache data for use while offline, and re-synchronize data and tasks with the network once the application goes online.

  7. fschwiet says:

    Hey I was just cruising the blogs and am not really up to speed on the smart client stuff.

    <TABLE ALIGN="CENTER" BORDER="1">

    <TR>

    <TD>Using the pluggable architecture of the block, you can implement a more meaningful offline state detection mechanism. For instance, you could periodically ping the required service, though arguably this is pretty inefficient and inelegant.

    </TD>

    </TR>

    </TABLE>

    A general approach that can work here though is to ping whenever a network connectoid becomes connected or disconnected. Ping the desired resource source, maybe authenticate the desired resource source if you care about a spoofed connected state. Its hard to have a generic connected/disconnected detector because the network of interest varies.

Skip to main content