Application Architecture RRS feed

  • Question

  • I will be copying data from my phone to desktop and then the desktop will communicate to a remote database through WCF.

    The phone data will overwrite the local db every time the data is copied from the phone to the desktop. 

    The local db is being synced with the masterdb which is also local. Note both the dbs are sqlite. The master db then communicate with the remote sql db through wcf.

    The phone can be plugged in to any of our 100 desktops . Means everytime new db is created .How to make sure the data is not duplicated on the main sql server db when moving around between different desktops?

    Do you think i can use msmq as well in this scenario  ? 



    usher A

    Monday, May 27, 2019 7:49 PM

All replies

  • Hi usher227,
    In order to ensure the data is not duplicated on the main SQL server, we should write the logic of the remote database insertion in the code to prevent the same records from being inserted repeatedly. In this case, Message Queuing ensures that every time a message that needs to be inserted into a remote database is definitely written to the remote database correctly, I think that's a great idea.
    Best Regards
    Tuesday, May 28, 2019 5:55 AM
  • The database is the best place to ensure that your data is good. For starters, you should create Unique Constraints on your tables.

    You can also handle this in code or in stored procedures if you are using them by only inserting records where to do NOT EXIST.

    Another thing you should consider is to implement optimistic concurrency. You can do this by adding a row version column to the table and check to see if the value has changed from the original value when updating.

    MSMQ can help a lot in some software architectures. It mainly addresses the use case of asynchronous message processing. For example, you have a service Service1 that communicates (send messages) with another part of your software architecture - Service2. Specifically, it addresses this common scenario: what if Service2 becomes suddenly unavailable? Will messages be lost? If you use MSMQ it won't: Service1 will send messages into a queue, and Service2 will dequeue when it is available.

    Using it depends on what your architecture is or what you want it to be.

    william xifaras

    Monday, June 10, 2019 3:29 PM