DataSets vs Serviced Component
-
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
-
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 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.
-
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.
-
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.
-
I think that the dataset-to-xml and xml-to-dataset coversion will cause a significant performance drop.
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.
-
I think that the dataset-to-xml and xml-to-dataset coversion will cause a significant performance drop.
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.
-
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.
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 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.
-
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
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.