Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. XML Model Structure

XML Model Structure

Scheduled Pinned Locked Moved Design and Architecture
csharplinqxmlperformancequestion
22 Posts 3 Posters 16 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L led mike

    Tristan Rhodes wrote:

    The application is in .Net 2.0, and the XDocument object is 3.5.

    Sure but 2.0 has other things like DataTable and DataSet which do have events?

    led mike

    T Offline
    T Offline
    Tristan Rhodes
    wrote on last edited by
    #6

    Hi Mike, I don't think DataSets are appropriate to this problem. But i'm not sure what is. I've never encountered anything like this before so my approach may be wrong. I'll try to describe the application and my approach. 1) There is a hierachy of configurations, where a configuration represents a setup for physical goods. The hierachy represents their association. 2) Each configuration contains a block (Tree) of layout data for a visual designer, a block of Aggregates, and a number of other blocks representing various tertiary data tied to the configuration. 3) A number of different controls are bound to the blocks of data for a selected configuration, as well as a number of controls being bound to the hierachy of configuration (From point 1). 4) I am attempting to implement an MVC pattern, where the model would be the XML DOM, the view would be the various controls that are bound to the model, and the controller is the host form (for now) that handles events submitted from the various controls. 5) When the model is changed, i would like to update the views with the changes made. (This is my primary problem). I do not want to re-query the model completely and re-draw the UI when a block is changed, i am only interested in the actual changes made. 6) I require Undo / Redo functionality (Simple enough with an XML Document) 7) Not all displayed data is stored in the model. When the model changes an alternative data source is queried to load Images, Layout data and other values. It makes me really appreciate how easy web development is when you just re-poll the model and draw a new page / widget. If you could point me in the right direction with regards to an approach to this problem, it would be greatly appreciated. Alternatively design patterns that are relevant or strategies for solving any of the above issues individually would be just as good. Cheers Tris

    ------------------------------- Carrier Bags - 21st Century Tumbleweed.

    L 1 Reply Last reply
    0
    • T Tristan Rhodes

      Hi Mike, I don't think DataSets are appropriate to this problem. But i'm not sure what is. I've never encountered anything like this before so my approach may be wrong. I'll try to describe the application and my approach. 1) There is a hierachy of configurations, where a configuration represents a setup for physical goods. The hierachy represents their association. 2) Each configuration contains a block (Tree) of layout data for a visual designer, a block of Aggregates, and a number of other blocks representing various tertiary data tied to the configuration. 3) A number of different controls are bound to the blocks of data for a selected configuration, as well as a number of controls being bound to the hierachy of configuration (From point 1). 4) I am attempting to implement an MVC pattern, where the model would be the XML DOM, the view would be the various controls that are bound to the model, and the controller is the host form (for now) that handles events submitted from the various controls. 5) When the model is changed, i would like to update the views with the changes made. (This is my primary problem). I do not want to re-query the model completely and re-draw the UI when a block is changed, i am only interested in the actual changes made. 6) I require Undo / Redo functionality (Simple enough with an XML Document) 7) Not all displayed data is stored in the model. When the model changes an alternative data source is queried to load Images, Layout data and other values. It makes me really appreciate how easy web development is when you just re-poll the model and draw a new page / widget. If you could point me in the right direction with regards to an approach to this problem, it would be greatly appreciated. Alternatively design patterns that are relevant or strategies for solving any of the above issues individually would be just as good. Cheers Tris

      ------------------------------- Carrier Bags - 21st Century Tumbleweed.

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #7

      Not a bad story but you never explain this:

      Tristan Rhodes wrote:

      I don't think DataSets are appropriate to this problem.

      If you think it is obvious from your post it's not, at least to me. I have implemented several .NET Desktop applications that use MVC with a DataSet at the core of the Model. In some cases the Data source is an XML file. However in most cases I started out thinking XML files would work and quickly moved on to using the SQL Desktop Database. Our main .NET Desktop/Web application uses a Database with NHibernate and an Object Model. In my experience and listening to others on the internet talk about managing the session and data layers from a development standpoint, there is no silver bullet, period. You can't just drag and drop controls and handle events to generate a complete solution. If your project data has any level of complexity, and yours certainly does, you will have to do some development. Also IMHO Databases still rule when it comes to managing complex data relationships. If your project is large enough you might want to look into the Castle ActiveRecord implementation[^] which uses NHibernate.

      led mike

      T 1 Reply Last reply
      0
      • L led mike

        Not a bad story but you never explain this:

        Tristan Rhodes wrote:

        I don't think DataSets are appropriate to this problem.

        If you think it is obvious from your post it's not, at least to me. I have implemented several .NET Desktop applications that use MVC with a DataSet at the core of the Model. In some cases the Data source is an XML file. However in most cases I started out thinking XML files would work and quickly moved on to using the SQL Desktop Database. Our main .NET Desktop/Web application uses a Database with NHibernate and an Object Model. In my experience and listening to others on the internet talk about managing the session and data layers from a development standpoint, there is no silver bullet, period. You can't just drag and drop controls and handle events to generate a complete solution. If your project data has any level of complexity, and yours certainly does, you will have to do some development. Also IMHO Databases still rule when it comes to managing complex data relationships. If your project is large enough you might want to look into the Castle ActiveRecord implementation[^] which uses NHibernate.

        led mike

        T Offline
        T Offline
        Tristan Rhodes
        wrote on last edited by
        #8

        Hi Mike, Thanks for the input. I Can't explain why DataSets are not appropriate, as i'm not sure what concrete reasons i have. I just have a feeling that going down that route would produce bad results, and i've been stung by DataSets before. In the end, i decided to go with a bog standard XML DOM, and build an API Class(s) that applies transformations, queries the data, and raises application specific events when the DOM changes. I'll just see how it goes. Cheers Tris

        ------------------------------- Carrier Bags - 21st Century Tumbleweed.

        L 1 Reply Last reply
        0
        • T Tristan Rhodes

          Hi Mike, Thanks for the input. I Can't explain why DataSets are not appropriate, as i'm not sure what concrete reasons i have. I just have a feeling that going down that route would produce bad results, and i've been stung by DataSets before. In the end, i decided to go with a bog standard XML DOM, and build an API Class(s) that applies transformations, queries the data, and raises application specific events when the DOM changes. I'll just see how it goes. Cheers Tris

          ------------------------------- Carrier Bags - 21st Century Tumbleweed.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #9

          Tristan Rhodes wrote:

          I just have a feeling

          Some friendly advice. Don't base your technical decisions on your feelings. ;) Seriously, in todays world the availability of information eliminates the need to make blind decisions that were common years ago and resulted in the mountains of Technical Debt[^] that exist in the industry today.

          led mike

          T 1 Reply Last reply
          0
          • L led mike

            Tristan Rhodes wrote:

            I just have a feeling

            Some friendly advice. Don't base your technical decisions on your feelings. ;) Seriously, in todays world the availability of information eliminates the need to make blind decisions that were common years ago and resulted in the mountains of Technical Debt[^] that exist in the industry today.

            led mike

            T Offline
            T Offline
            Tristan Rhodes
            wrote on last edited by
            #10

            It's past experience as well, and i have looked into it. :P I love the concept of Code Debt. Spent ages trying to get management to see what it was in my last job, but there's only so much you can teach old school VB heads. ^^ [Edit] And if you say you've never looked at a design or section of code and thought "Something is seriously wrong, but i can't put my finger on it.", i think you lie :P

            ------------------------------- Carrier Bags - 21st Century Tumbleweed.

            1 Reply Last reply
            0
            • T Tristan Rhodes

              Hi Guys, I have a large, and quite complicated model that i origionaly defined using an object hierachy, but the solution has out grown that. I require an in memory model that raises events when it is changed. These events can then be handled by any observing controls which in turn can update themselves. As the model is large, and each control is only interested in one particular part of the Model, i would like to be able to pull out a section of the XML document and observe and apply changes to this block. Idealy i would like to be able to pull an XmlDocument from another XmlDocument and use that, but keeping it synchronised with the parent document. I am limited to the XmlDocument object due to a .Net 2.0 limitation, although the XDocument (And associated LINQ model) would be perfect for what i am trying to achieve as each node raises change events that bubble up the object hierachy. Are there any other solutions anyone else can think of? Cheers Tris

              ------------------------------- Carrier Bags - 21st Century Tumbleweed.

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #11

              One word. INotifyPropertyChanged. Have a look at this little puppy - it can be your best friend.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              T L 2 Replies Last reply
              0
              • P Pete OHanlon

                One word. INotifyPropertyChanged. Have a look at this little puppy - it can be your best friend.

                Deja View - the feeling that you've seen this post before.

                My blog | My articles

                T Offline
                T Offline
                Tristan Rhodes
                wrote on last edited by
                #12

                AHHH! I wish i knew about that 4 weeks ago :(

                ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                P 1 Reply Last reply
                0
                • T Tristan Rhodes

                  AHHH! I wish i knew about that 4 weeks ago :(

                  ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #13

                  Tristan Rhodes wrote:

                  I wish i knew about that 4 weeks ago

                  Sorry. I only just read this thread last night.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  T 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    Tristan Rhodes wrote:

                    I wish i knew about that 4 weeks ago

                    Sorry. I only just read this thread last night.

                    Deja View - the feeling that you've seen this post before.

                    My blog | My articles

                    T Offline
                    T Offline
                    Tristan Rhodes
                    wrote on last edited by
                    #14

                    No worries. I don't think that it's suited for the problem i had, but it definitely has some uses is some other stuff i was working on. :)

                    ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                    P 1 Reply Last reply
                    0
                    • T Tristan Rhodes

                      No worries. I don't think that it's suited for the problem i had, but it definitely has some uses is some other stuff i was working on. :)

                      ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #15

                      To be honest, I'm having a little trouble picking up the problem domain from this thread. I'm not sure why you need the XML and why you can't use properties.

                      Deja View - the feeling that you've seen this post before.

                      My blog | My articles

                      T 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        To be honest, I'm having a little trouble picking up the problem domain from this thread. I'm not sure why you need the XML and why you can't use properties.

                        Deja View - the feeling that you've seen this post before.

                        My blog | My articles

                        T Offline
                        T Offline
                        Tristan Rhodes
                        wrote on last edited by
                        #16

                        Well, i'm trying to route all events through a single root object, only wiring up a hierachy of observable lists, trees and properties to do that will be an absolute nightmare as the model is growing almost daily. Additionally, i need to be able to run XPath queries on any part of the model and define some kind of schema to validate against. Which i couldn't do with objects. It's a desktop app if that makes any difference, and the XML would be the state of the solution and everything pretty much revolves around changing that and keeping display parts synchronized with it. Not sure how to describe it beyond that. :)

                        ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                        P 1 Reply Last reply
                        0
                        • T Tristan Rhodes

                          Well, i'm trying to route all events through a single root object, only wiring up a hierachy of observable lists, trees and properties to do that will be an absolute nightmare as the model is growing almost daily. Additionally, i need to be able to run XPath queries on any part of the model and define some kind of schema to validate against. Which i couldn't do with objects. It's a desktop app if that makes any difference, and the XML would be the state of the solution and everything pretty much revolves around changing that and keeping display parts synchronized with it. Not sure how to describe it beyond that. :)

                          ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #17

                          Short of hashing the different observable portions and then periodically checking to see if the hash has changed, tricky. Although if you implemented this with MVC, then it would be less tricky.

                          Deja View - the feeling that you've seen this post before.

                          My blog | My articles

                          1 Reply Last reply
                          0
                          • P Pete OHanlon

                            One word. INotifyPropertyChanged. Have a look at this little puppy - it can be your best friend.

                            Deja View - the feeling that you've seen this post before.

                            My blog | My articles

                            L Offline
                            L Offline
                            led mike
                            wrote on last edited by
                            #18

                            Pete O'Hanlon wrote:

                            INotifyPropertyChanged

                            That appears to be new in 3.5, yes? I haven't been there yet.

                            led mike

                            T P 2 Replies Last reply
                            0
                            • L led mike

                              Pete O'Hanlon wrote:

                              INotifyPropertyChanged

                              That appears to be new in 3.5, yes? I haven't been there yet.

                              led mike

                              T Offline
                              T Offline
                              Tristan Rhodes
                              wrote on last edited by
                              #19

                              It's been around since 2.0.

                              ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                              1 Reply Last reply
                              0
                              • L led mike

                                Pete O'Hanlon wrote:

                                INotifyPropertyChanged

                                That appears to be new in 3.5, yes? I haven't been there yet.

                                led mike

                                P Offline
                                P Offline
                                Pete OHanlon
                                wrote on last edited by
                                #20

                                led mike wrote:

                                That appears to be new in 3.5, yes?

                                .NET 2.0. I've used it to manage Dirty states in classes - it's rather neat.

                                Deja View - the feeling that you've seen this post before.

                                My blog | My articles

                                L 1 Reply Last reply
                                0
                                • P Pete OHanlon

                                  led mike wrote:

                                  That appears to be new in 3.5, yes?

                                  .NET 2.0. I've used it to manage Dirty states in classes - it's rather neat.

                                  Deja View - the feeling that you've seen this post before.

                                  My blog | My articles

                                  L Offline
                                  L Offline
                                  led mike
                                  wrote on last edited by
                                  #21

                                  I still can't find the 2.0 Reference to this puppy?[^] :confused: System.ComponentModel.INotifyPropertyChanged Finally! Geez, apparently I have been implementing the IAmAnIdiot interface :doh:


                                  Last modified: 45mins after originally posted --

                                  led mike

                                  P 1 Reply Last reply
                                  0
                                  • L led mike

                                    I still can't find the 2.0 Reference to this puppy?[^] :confused: System.ComponentModel.INotifyPropertyChanged Finally! Geez, apparently I have been implementing the IAmAnIdiot interface :doh:


                                    Last modified: 45mins after originally posted --

                                    led mike

                                    P Offline
                                    P Offline
                                    Pete OHanlon
                                    wrote on last edited by
                                    #22

                                    led mike wrote:

                                    Geez, apparently I have been implementing the IAmAnIdiot interface

                                    No fair. I copyrighted that one. ;)

                                    Deja View - the feeling that you've seen this post before.

                                    My blog | My articles

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups