473,320 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Serialization and Shared Interfaces

Hello:

I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client, but it doesn't implement the
interface. This means that I have to implement another class that
implements the interface, which I build from the web service class. So
I always have to convert one to the other every time I call the web
service.

Is there are way to make the automatically generated class implement
the interface?

Thanks,
Travis
Jul 15 '08 #1
8 1449
Why not simply implement your concrete class as a DLL and distribute that to
the client machines. Then you only need to write the implementation once.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<je**********@gmail.comwrote in message
news:6b**********************************@y38g2000 hsy.googlegroups.com...
Hello:

I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client, but it doesn't implement the
interface. This means that I have to implement another class that
implements the interface, which I build from the web service class. So
I always have to convert one to the other every time I call the web
service.

Is there are way to make the automatically generated class implement
the interface?

Thanks,
Travis
Jul 15 '08 #2
Mr. Powell:

I have a question I posted the day before entitled "Deploying with DLLs."

I have not received a response, and I was hoping you might know something
about this, being an [MVP] and because you just suggested this to the OP.

How do I deploy a Windows Form application that includes DLLs? Someone has
told me that I need to specify my DLLs in the app.config so that the .Net
Framework would not block it as a security issue, but he wasn't able to tell
me how to do this.

I have found the MSDN "Runtime Settings Schema" online, but I don't know
what I should do to impliment it.

Any help or pointers would be appreciated.

"Bob Powell [MVP]" wrote:
Why not simply implement your concrete class as a DLL and distribute that to
the client machines. Then you only need to write the implementation once.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<je**********@gmail.comwrote in message
news:6b**********************************@y38g2000 hsy.googlegroups.com...
Hello:

I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client, but it doesn't implement the
interface. This means that I have to implement another class that
implements the interface, which I build from the web service class. So
I always have to convert one to the other every time I call the web
service.

Is there are way to make the automatically generated class implement
the interface?

Thanks,
Travis

Jul 15 '08 #3
On Jul 15, 8:42*am, "jehugalea...@gmail.com" <jehugalea...@gmail.com>
wrote:
Hello:

I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client
If this class is the same it will have declared that it implements the
interface so you can simply cast the instance to the interface without
any problem
Jul 15 '08 #4
On Jul 15, 9:49*am, jp2msft <jp2m...@discussions.microsoft.comwrote:
Mr. Powell:

I have a question I posted the day before entitled "Deploying with DLLs."

I have not received a response, and I was hoping you might know something
about this, being an [MVP] and because you just suggested this to the OP.

How do I deploy a Windows Form application that includes DLLs? Someone has
told me that I need to specify my DLLs in the app.config so that the .Net
Framework would not block it as a security issue, but he wasn't able to tell
me how to do this.

I have found the MSDN "Runtime Settings Schema" online, but I don't know
what I should do to impliment it.

Any help or pointers would be appreciated.

"Bob Powell [MVP]" wrote:
Why not simply implement your concrete class as a DLL and distribute that to
the client machines. Then you only need to write the implementation once.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<jehugalea...@gmail.comwrote in message
news:6b**********************************@y38g2000 hsy.googlegroups.com....
Hello:
I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client, but it doesn't implement the
interface. This means that I have to implement another class *that
implements the interface, which I build from the web service class. So
I always have to convert one to the other every time I call the web
service.
Is there are way to make the automatically generated class implement
the interface?
Thanks,
Travis- Hide quoted text -

- Show quoted text -
Hi,

What kind of dlls ?
If you want to include a DLL in the setup just add the dll in the
deployment project and ready.
I have a solution where the "main" content of the setup project is the
output of a win app that seats in the same solution, but at the same
time I add a couple of DLLs that do not form part of the win app but
that it load dynamically.
Jul 15 '08 #5
On Jul 15, 4:42*pm, "jehugalea...@gmail.com" <jehugalea...@gmail.com>
wrote:
I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client, but it doesn't implement the
interface. This means that I have to implement another class *that
implements the interface, which I build from the web service class. So
I always have to convert one to the other every time I call the web
service.

Is there are way to make the automatically generated class implement
the interface?
No. If you look at the contract of your Web service, you'll see that
there is no information there that could be used to derive information
about things such as interface implementations for the automatic class
generator to use. It's just the way Web services work. If you want
this sort of thing, you'll have to give your DLL with the class
implemented the way you want to the clients.
Jul 15 '08 #6

You can check these 2 articles out:

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!122.entry

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!158.entry
If you're living in a DotNet to DotNet world, then I would especially look
at the second one.
You can distribute the Interface definition to the client, and you won't
have to deal so much with the proxy classes on the client.


<je**********@gmail.comwrote in message
news:6b**********************************@y38g2000 hsy.googlegroups.com...
Hello:

I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client, but it doesn't implement the
interface. This means that I have to implement another class that
implements the interface, which I build from the web service class. So
I always have to convert one to the other every time I call the web
service.

Is there are way to make the automatically generated class implement
the interface?

Thanks,
Travis

Jul 15 '08 #7
Hello Mr. Machin,

I'm beginning to think my problem was two fold: 1) I did not have a strong
name key associated with my DLLs, and 2) I did not have these DLLs referenced
in the app.config file for my application using their public key tokens.

I've done this, and now I am going to try my deployment again to see if I
have better results.

Regards,
Joe

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

What kind of dlls ?
If you want to include a DLL in the setup just add the dll in the
deployment project and ready.
I have a solution where the "main" content of the setup project is the
output of a win app that seats in the same solution, but at the same
time I add a couple of DLLs that do not form part of the win app but
that it load dynamically.
Jul 15 '08 #8
On Jul 15, 7:56*am, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Jul 15, 8:42*am, "jehugalea...@gmail.com" <jehugalea...@gmail.com>
wrote:
Hello:
I have a Serializable class that I pass to clients via web services.
In the web service, the class implements a shared interface. The
clients also use the interface. The web reference automatically
creates an class on the client

If this class is the same it will have declared that it implements the
interface so you can simply cast the instance to the interface without
any problem
When you return classes from a web service they are serialized into
SOAP. The requesting source only sees the properties and has no idea
about subclasses, interfaces or anything like that. If I was just
serializing, it wouldn't make a bit of difference. I was hoping there
was a way to tweak the web service definition so that it added the
interface to the dynamically generated class.
Jul 15 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Daniel Faensen | last post by:
As a good OO programmer that I hopefully am I prefer to implement against interfaces rather than classes. This is especially useful when it comes to multiple inheritance which is as you know an...
6
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or...
10
by: Michael Maes | last post by:
Hi, I have a BaseClass from which many Classes Derive. In short: the BaseClass provides the functionalities (Methods) and the Derived Classes extend it with Properties. One of the (Base)...
0
by: JosAH | last post by:
Introduction Upon hearing the word, "Serialization", the first question which comes to mind is ... "What is Serialization?" We know that we can create resusable objects in Java. But the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.