none
How and how often does an Entity Data Model update from the database? RRS feed

  • Question

  • I am new to the software development game, and I am investigating improving a long-standing system.

    Currently: a VB6 client program, of which there are over a hundred instances running at any one time, needs up-to-date information from a single database.  Currently it does this by running SQL queries using RDO to pull down a completely new dataset (including thousands of rows of data) every 5s.  As the system grows larger, this is placing more and more strain on networking, and the system as a whole is lagging as you would well expect.

    Everything is to be updated into VB.NET, and this makes for an ideal time to re-design the way we handle the data.  The plan is to have a single program watching the database for changes, and have this program pick up changes to data and send it to a registered list of active clients that have an interest in that data.  So instead of hundreds of programs constantly querying the database, we have only one, and network traffic is only generated when there is actually something to update.

    I like the look of the Entity Data Model as a way of client-loading the stored procedures we currently have on the database server, further reducing network traffic.  My questions then are:

    When does the contents of an EDM update from the database?

    Can I feed changes to the data within the EDM from another program, rather than have the EDM go asking for a new set of data?

    Can I code an event handler for the EDM receiving updated information so that the program knows a display update is required?

    To be clear, I don't need to update the structure of the model, as similar questions have been regarding, only the data within it.  I need the data to be accurate to within 5s and preferably much faster than that.  This is a read-only application, this EDM will never have to pass updates back to the database.

    Tuesday, September 13, 2011 2:58 PM

Answers

  • The EDM entity data model (on the designer surface) only updates the schema when you manually do that.  The entities themselves (the data) are updated by the program when you tell it to using traditional program designs surronding those entities. 

    You may want to look into a few things here.  WCF has duplex capability, so in essence you establish a service that uses EF4.1 as a model.  Then because it's duplex you have the DB side push the updates when needed.  In Silverlight they even go one step futher with WCF in creating a new layer they call RIA, it's very slick but is primarily for web based operations.  WPF doesn't yet have RIA but it does fully support everything else (WCF wise).

    OR and perhaps a better design is to look into Reactive Extensions.  This support is built to reverse the event model from a pull state to a push state.  That is when something happens, the data is pushed to the subscribers.  It is the most effective way to push information and is most likely a much better design than pulll based operations.

     


    JP
    Tuesday, September 13, 2011 3:32 PM