Sending DataSet to Remoting Service

S

sjoshi

Hi All

I have written an Windows Service that exposes a Remoting object that
takes a DataSet and fills it up. However when I get the dataset back
on the client it's rows are empty. When I log the process I can see a
filled dataset on the server.

This is what I'm doing in the client code, where dSet is an empty
initialized DataSet being sent to the server.

IPDLiceOutputFactory factory = GetRemotingFactory(server);
IPDLiceOutput output = factory.GetBuilder(source, null); //
Here I get a snapshot builder
output.FillDataSet(outputType, dSet);

The factory is...

public class ImpliedFactory: MarshalByRefObject, IPDLiceOutputFactory
{
private IPDLiceOutput GetSnapshotBuilder(string server)
{
SnapshotBuilder builder = new SnapshotBuilder(server);
return (IPDLiceOutput)builder;
}
private IPDLiceOutput GetLoggedBuilder(string server)
{
LoggedBuilder builder = new LoggedBuilder();
return (IPDLiceOutput)builder;
}

#region IPDLiceOutputFactory Members
public IPDLiceOutput GetBuilder(OutputSource builderType, string
server)
{
if (builderType == OutputSource.Snapshot)
return GetSnapshotBuilder(server);
return GetLoggedBuilder(server);
}

#endregion
}

The builder I use is...

public class SnapshotBuilder : MarshalByRefObject, IPDLiceOutput
{
private string _server;
public SnapshotBuilder(string server)
{
_server = server;
}

#region IPDLiceOutput Members

public void FillDataSet(OutputType outputType, PDliceDataSet dSet)
{
PDLiceOutput outputBuilder = new PDLiceOutput(_server,
outputType);
PDLiceDataSetBuilder dsetBuilder = new
PDLiceDataSetBuilder(outputBuilder, DateTime.Now);
dsetBuilder.FillDataSet(dSet);

}

#endregion

The interfaces are defined as...

public interface IPDLiceOutputFactory
{
IPDLiceOutput GetBuilder(OutputSource builderType, string arg);
}

public interface IPDLiceOutput
{
void FillDataSet(OutputType outputType, PDliceDataSet dSet);
}

Any ideas what might be wrong here ??

Sunit
 
N

Nicholas Paldino [.NET/C# MVP]

When you remote an instance by value, unless you have a ref or out
parameter, the details of the instance are not passed back over the remoting
channel.

Try changing your parameter to ref or out and you should see the changes
reflected back in the calling client.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top