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. C#
  4. DataSets vs Serviced Component

DataSets vs Serviced Component

Scheduled Pinned Locked Moved C#
helpcsharpdotnetvisual-studiosysadmin
10 Posts 3 Posters 0 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.
  • S Offline
    S Offline
    schockp
    wrote on last edited by
    #1

    Hello, I'm experiencing a problem with DataSets. If I use a DataSet as a parameter of a method in a Serviced Component, I always receive an InvalidCastException because something is trying to convert __ComObject to DataSet. When a method only returns a DataSet (no DataSet as parameter) there's no problem. I'm running my application with framework 1.1, the serviced component is in Server mode. Is this some bug in the .Net framework? :confused: Has anyone a solution or a workaround for this problem? best regards, Pieter

    I 1 Reply Last reply
    0
    • S schockp

      Hello, I'm experiencing a problem with DataSets. If I use a DataSet as a parameter of a method in a Serviced Component, I always receive an InvalidCastException because something is trying to convert __ComObject to DataSet. When a method only returns a DataSet (no DataSet as parameter) there's no problem. I'm running my application with framework 1.1, the serviced component is in Server mode. Is this some bug in the .Net framework? :confused: Has anyone a solution or a workaround for this problem? best regards, Pieter

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      I don't know the answer but does the dataset serialize. You might have to implement the serializable interface. or just shoot it as an xml stream through. Com passes it as a stream anyhow. I'm not an expert yet, but I play one at work. Yeah and here too.

      S 1 Reply Last reply
      0
      • I Ista

        I don't know the answer but does the dataset serialize. You might have to implement the serializable interface. or just shoot it as an xml stream through. Com passes it as a stream anyhow. I'm not an expert yet, but I play one at work. Yeah and here too.

        S Offline
        S Offline
        schockp
        wrote on last edited by
        #3

        Thanks for replying. I'm not sure if a dataset is serializable, I'll check it out. Running the component in Library mode doesn't have this problem, although there's a problem with my database connection. But that's some security issue I think.

        I 1 Reply Last reply
        0
        • S schockp

          Thanks for replying. I'm not sure if a dataset is serializable, I'll check it out. Running the component in Library mode doesn't have this problem, although there's a problem with my database connection. But that's some security issue I think.

          I Offline
          I Offline
          Ista
          wrote on last edited by
          #4

          it might be easier to parse it as xml "WriteXML() method" then send it through I'm not an expert yet, but I play one at work. Yeah and here too.

          S 1 Reply Last reply
          0
          • I Ista

            it might be easier to parse it as xml "WriteXML() method" then send it through I'm not an expert yet, but I play one at work. Yeah and here too.

            S Offline
            S Offline
            schockp
            wrote on last edited by
            #5

            I think that the dataset-to-xml and xml-to-dataset coversion will cause a significant performance drop.

            J I 2 Replies Last reply
            0
            • S schockp

              I think that the dataset-to-xml and xml-to-dataset coversion will cause a significant performance drop.

              J Offline
              J Offline
              Jarrod Marshall
              wrote on last edited by
              #6

              I ran into this problem working with C# based queued components. Datasets are serializable, they support ISerializable however alot of things with COM+ (especially with Queued Components) is that they need the components to support IPersist. They have no idea how to serialize using the ISerializable interface therefore you either go the route of dataset--> XML, XML--> dataset or implement IPersist within your component.

              S 1 Reply Last reply
              0
              • S schockp

                I think that the dataset-to-xml and xml-to-dataset coversion will cause a significant performance drop.

                I Offline
                I Offline
                Ista
                wrote on last edited by
                #7

                Well its relatively fast and uses a buffered stream. I mean really when your marshalling your Dataset you serialize the object to text then back again. And its basically the same thing. WriteXML is the fastest firehose method of the class. But yeah it would be better to do a dataset. You might try createing an object, clone the dataset to that object then marshalling it over the boundary. That might work. Or use the serializable attribute above a custom class that inherits the dataset. Personally, With DataSets I use reflection to populate classes then update them with COM+ life cycles. Much more elegant and easier to load balance. That and business rules on forms and behind the scenes are simple to implement. nick I'm not an expert yet, but I play one at work. Yeah and here too.

                S 1 Reply Last reply
                0
                • I Ista

                  Well its relatively fast and uses a buffered stream. I mean really when your marshalling your Dataset you serialize the object to text then back again. And its basically the same thing. WriteXML is the fastest firehose method of the class. But yeah it would be better to do a dataset. You might try createing an object, clone the dataset to that object then marshalling it over the boundary. That might work. Or use the serializable attribute above a custom class that inherits the dataset. Personally, With DataSets I use reflection to populate classes then update them with COM+ life cycles. Much more elegant and easier to load balance. That and business rules on forms and behind the scenes are simple to implement. nick I'm not an expert yet, but I play one at work. Yeah and here too.

                  S Offline
                  S Offline
                  schockp
                  wrote on last edited by
                  #8

                  Nick, Thanks for your input! I'm really new to Serviced Components and COM+. Can you explain your way of working a bit more? I don't understand what you mean with: Ista wrote: With DataSets I use reflection to populate classes then update them with COM+ life cycles Yeah, I know what reflection is, but the combination with datasets and populate classes is unclear to me. Pieter

                  I 1 Reply Last reply
                  0
                  • J Jarrod Marshall

                    I ran into this problem working with C# based queued components. Datasets are serializable, they support ISerializable however alot of things with COM+ (especially with Queued Components) is that they need the components to support IPersist. They have no idea how to serialize using the ISerializable interface therefore you either go the route of dataset--> XML, XML--> dataset or implement IPersist within your component.

                    S Offline
                    S Offline
                    schockp
                    wrote on last edited by
                    #9

                    Jarrod, Thanks, I'll take a look at how to implement the IPersist interface. Pieter

                    1 Reply Last reply
                    0
                    • S schockp

                      Nick, Thanks for your input! I'm really new to Serviced Components and COM+. Can you explain your way of working a bit more? I don't understand what you mean with: Ista wrote: With DataSets I use reflection to populate classes then update them with COM+ life cycles Yeah, I know what reflection is, but the combination with datasets and populate classes is unclear to me. Pieter

                      I Offline
                      I Offline
                      Ista
                      wrote on last edited by
                      #10

                      Well simply put I create a class LastName FirstName SSN if table looks like EmployeeID LastName FirstName SocialSecurityNumber then my select would look like: SELECT EmployeeID = ID, LastName, FirstName, SSN = SocialSecurityNumber then I would use a DataReader becuase its much faster For each row I would create the class based on the primaryID ( EmployeeID ) Then I would iterate through the GetValues array returned by the datareader using reflection I use the PropertyType and propertyInfo classes to populate the fields. I haven't taken on the method part but thats next month on my development cycle nick I'm not an expert yet, but I play one at work. Yeah and here too.

                      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