CodeSmith Community
Your Code. Your Way. Faster!

Serialize/Export Entities as XML ?

Latest post 12-08-2006 1:06 PM by Miketrix. 4 replies.
  • 11-29-2006 4:55 PM

    • Miketrix
    • Top 50 Contributor
    • Joined on 03-06-2006
    • Brussels
    • Posts 69
    • Points 1,885

    Serialize/Export Entities as XML ?

    Hi all,

    I'm working on a projet having both windows and web client. Here is the basic idea:

    1. The Windows Client : an admin tools that communicates with the Web Application through WebServices from the Web App. The client uses a local SQL Server to manage data (clients, contracts, contacts, payments, ...).
    2. The Web App : a WebSite that allows clients to manage their data online.
    (So far, I'm only using NetTiers on the Windows Client App, not on the Web App... )

    To achieve this, the Windows Client will synchronize the local data (take a snapshot of data from specified clients) and send it to the Web App (using WebServices). The data sent must only be READ by the Web App, NEVER UPDATED. All new or updated data entered by the client on the WebSite will have to be submitted to the Administrators for validation. It will work using 'modification tickets'. All tickets are retrieved by the Win Client when synchronizing the data. Once validated, the content of the ticket is submitted to the local system, which will be updated at next synchronization (and so on...).

    I have some questions regarding the synchronization process:

    • First, what do you think about this solution ? The Web App will have to manage two distinct types of data : synchronized (coming from local system) and 'unvalidated' (entered by user through website, as a 'ticket'). Having an SQL Database for the Web App, I could choose to manage it all in the DB, but since:
      • All the data coming from the local system should ONLY be READ !!! never modified, I though that it could be kept as XML format (using serialization, for example, and even maybe (extra stuff) ecrypted?? (for security) and zipped ?? (for speed) when sent by Webservice).
      • All modifications entered by the client on the web could possibly be updated/deleted quite often, so I think it's easier to handle it from SQL and not from XML (needing to parse the file, etc..).
    • I could eventually manage everything IN the database, but the problem is that the entities from the local system and the ones from the Web App are slightly different, because some data from local won't be copied to the Web, and entities from the Web will need extra info for the synchronization status (not defined in local), etc... So I don't think I could use the same entities from NetTiers generated code.
    • So here is the final question : is it a way to serialize Entities to XML (or should I simply fill a DataSet with all the needed data and call the SaveAsXML ?). It could be easy if I could Deepload all the needed data, starting from the top object (here : the client), loading all it's contracts, all it's contacts, etc... And save it as a clear xml format, which could be reused on the Web App... ? The file would then be stored on WebServer and deserialized when client would connect to its session and view his data.

    Okey, it's a whole tricky thing Wink so if you have comments, they will be welcome ! But please, if anyone could give me answers to the previous questions, this would really help me going the step further in my project.

    Thanks by advance !

    Mike.
     

     

    • Post Points: 35
  • 12-01-2006 4:41 AM In reply to

    • Miketrix
    • Top 50 Contributor
    • Joined on 03-06-2006
    • Brussels
    • Posts 69
    • Points 1,885

    Re: Serialize/Export Entities as XML ?

    Help from anyone ?... Plz Huh?
    Filed under: , ,
    • Post Points: 5
  • 12-01-2006 11:49 AM In reply to

    Re: Serialize/Export Entities as XML ?

    Umm, I'm unsure about storing each users' data as an xml file.  To me, even though it's readonly, it's not worth having to manage that many files, which can get ugly in a hurry (unless we're talking about, 10 users or so).  Being that they're readonly, I think an application cache would work best in this scenario where each users data is just stored in cached, and when invalidated, is synched up again. The only caution I have here is depending on memory requirements and how large the data in question is, coupled with the user count.  I just don't think that doing it the XML route (a completely valid approach) is giong to "help" this application.  What's the primary reason you're wanting an XML store vs in memory.  I see your reasoning from the DB side of things from a winclient perspective.

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 60
  • 12-02-2006 8:18 AM In reply to

    • Miketrix
    • Top 50 Contributor
    • Joined on 03-06-2006
    • Brussels
    • Posts 69
    • Points 1,885

    Re: Serialize/Export Entities as XML ?

    Hi Robert,

     

    Thank you for your comment.

    Actually, I'm thinking about XML because :

    - local data comes from the local DB which is designed with many tables, relations and constraints... Bringing the whole thing to the Web Database would be too complex, I think, because I would never access this data for modifications, except I need to resync it often (I would find worst to have to DELETE or MODIFY / RE-INSERT all the data each time a synchronization process is executed... Isn't it ?)... Therefore, I found the XML file way not so 'beautiful' from architecture and design perspective, but it could provide a flexible way to manage it ...

    I mean, the most likely, there will be frequent changes in the local database in the future, which will have to be handled by the local system (no big changes, but new fields or new tables... not removing the existing ones). I don't want to have to update the whole website each time we provide little enhencement to the local DB. So, I was pleased with the dataset/xml way because I could access the fields using their names (ok, horrible for low coupled designs) but at least, this would be easy to maintain.

    This system is not intented for really huge db, in our old system, we have 18.000 files from which multiples are related to the same client... We do not expect to have 18000 files to manage for the Web App really soon (if it would grow up with such needs, we could review the system for better performance). For the moment, i'm worried about development quickness, maintenance and adaptability...

    That's why I would not use the NetTiers templates to manage the read-only data but some 'hand-made" objects, using a Xml helper...

     About my question to serialize the NetTiers entities in XML, is is a supported (or easy) way of doing:

    • load a client entity
    • deepload all its contracts
    • deepload all its related contacts
    • deepload all its addresses,
    • etc...
    • --> Serialize or Export the object to a readable XML file with the whole object tree ?
    • --> I think I saw there was an ExportToDataset method supported by the Entities... Would they answer to my needs ?


    Thanks anyway for all your comment. I'm still really not sure of how to make this so, any recommandation for an alternate solution will be welcome !

    Mike. 


     

    • Post Points: 5
  • 12-08-2006 1:06 PM In reply to

    • Miketrix
    • Top 50 Contributor
    • Joined on 03-06-2006
    • Brussels
    • Posts 69
    • Points 1,885

    Re: Serialize/Export Entities as XML ?

    Still no help on how to export entities tree to xml ? Hmm
    • Post Points: 5
Page 1 of 1 (5 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems