473,508 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

casting incomptability between 2 instances of the same class

Hi,

I am using 2 different web services: Manage_Login and Manage_Employee.
In these WS I can have the same message (using the appropriate
methods), and this message is an object that I serialize: Employee.

On the client side, after using my WS, I try to compare two objects:
Manage_Login.Employee and Manage_Employee.Employee. It is the same
class, from the same assembly (my underlying business objects
assembly), but coming from 2 different web services.

I get a casting incomptability between 2 instances of the same class.
Is there a way around that?

I would like not to have to write a function that does:
Manage_Login.Employee.Name=Manage_Employee.Employe e.Name;
Manage_Login.Employee.EMail=Manage_Employee.Employ ee.EMail;
....

thank you for you thoughts and help,
Pierre

Feb 21 '06 #1
4 1779
Does your Web Service and Main program access the same dll? Normally
when you add a reference to the web service, it creates a proxy class
with the same properties as the class in your assembly.

What is the exact error message you are getting? You might have to
hand modify the proxy code to point to your business objects.

Feb 21 '06 #2
Hi and thank you for that good hint Chris.
Does your Web Service and Main program access the same dll?
The Web Services indeed access the same dll (BusinessObjects.dll) in
which the messages are included.
Normally when you add a reference to the web service, it creates a proxy class with the same properties as the class in your assembly.
Yes and that's excatly the issue, by doing that visual studio creates
(on the client's side) two different classes out of 1 (on the server).
What is the exact error message you are getting?
Error 1 Cannot implicitly convert type 'Manage_Employee.TblEmployee' to
'Manage_Login.TblEmployee'
You might have to hand modify the proxy code to point to your business objects.


Very good idea, I am using vs 2005 and unfortunatly I cannot find the
proxy classes. I just see the disco, discomap and wsdl for each web
service. I don't find any code.

Best regards,
Pierre

Feb 22 '06 #3
I haven't yet worked with Web Services in 2005, only in 2003.

If you select the project in the solution explorer and then click the
"Show All Files" button perhaps that will reveal the code files.

Feb 22 '06 #4
Yes I've done that, but I still don't see any code. If anybody knows
where the proxy's code is with VS 2005 I'm sure I'm not the only one
that could use that info.

Or perhaps there's no code and vs is directly using the wsdl. As I
found another solution, I didn't go further with that.

Pierre

Feb 23 '06 #5

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

Similar topics

2
1770
by: Angelos Karantzalis | last post by:
Hi guys, I'm trying to load a class instance dynamically, and then cast it to it's base type so I can use it in my app. More specifically, I'm dynamically instantiating a...
7
3640
by: yufufi | last post by:
lets say we have a 'shape' class which doesn't implement IComparable interface.. compiler doesn't give you error for the lines below.. shape b= new shape(); IComparable h; h=(IComparable)b;...
7
30750
by: Jim Bancroft | last post by:
Hi everyone, A basic one here, I think. I haven't found the pattern yet, but sometimes when I cast a variable to another type using the "C" style cast operator the compiler refuses to play...
3
257
by: Pierre | last post by:
Hi, I am using 2 different web services: Manage_Login and Manage_Employee. In these WS I can have the same message (using the appropriate methods), and this message is an object that I...
8
2056
by: Herby | last post by:
Given class B and C which inherit from class A They all override a method of the form: Add( A^ lhs, A^ rhs ); So A is abstract. So if i was defining Add for class B : B::Add( A^ lhs, A^ rhs...
8
2408
by: Kris Jennings | last post by:
Hi, I am trying to create a new generic class and am having trouble casting a generic type to a specific type. For example, public class MyClass<Twhere T : MyItemClass, new() { public...
8
4247
by: Gamma | last post by:
I'm trying to inherit subclass from System.Diagnostics.Process, but whenever I cast a "Process" object to it's subclass, I encounter an exception "System.InvalidCastException" ("Specified cast is...
11
32216
by: Frederic Rentsch | last post by:
Hi all, If I derive a class from another one because I need a few extra features, is there a way to promote the base class to the derived one without having to make copies of all attributes? ...
9
2448
by: Jess | last post by:
Hello, It seems both static_cast and dynamic_cast can cast a base class pointer/reference to a derived class pointer/reference. If so, is there any difference between them? In addition, if I...
19
1910
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
I'm doing my c# more and more like i used to code c++, meaning i'm casting more often than creating an instance of objects. like : protected void gvOrderDetailsRowDataBound(object sender,...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.