Click here to Skip to main content
15,901,205 members
Home / Discussions / C#
   

C#

 
QuestionC# TCP networkstreem problem Pin
Titok Levi2-Oct-09 2:32
Titok Levi2-Oct-09 2:32 
AnswerRe: C# TCP networkstreem problem Pin
Luc Pattyn2-Oct-09 3:06
sitebuilderLuc Pattyn2-Oct-09 3:06 
AnswerRe: C# TCP networkstreem problem Pin
0x3c02-Oct-09 3:56
0x3c02-Oct-09 3:56 
AnswerRe: C# TCP networkstreem problem Pin
Tr@v2-Oct-09 16:26
Tr@v2-Oct-09 16:26 
GeneralRe: C# TCP networkstreem problem Pin
Titok Levi6-Oct-09 22:03
Titok Levi6-Oct-09 22:03 
QuestionGenerics, delegates and type inference Pin
dojohansen2-Oct-09 2:10
dojohansen2-Oct-09 2:10 
AnswerRe: Generics, delegates and type inference Pin
Gideon Engelberth2-Oct-09 6:29
Gideon Engelberth2-Oct-09 6:29 
GeneralRe: Generics, delegates and type inference Pin
dojohansen2-Oct-09 7:43
dojohansen2-Oct-09 7:43 
Thank you, that's the sort of simple and rather logical explanation I dared not hope for!

The declaration is
<br />
public LoginResp login(LoginReq request)<br />


LoginResp : APIResponse
LoginReq : APIRequest

However, I've found some worse caveats to deal with. The API has been divided into several services, but one needs data from one service to make requests to the other service - as well as the same session token for both as far as I understand, which means one cannot reliably call both services concurrently. A lot of types defined by the WSDL exist in both services. But of course, when I just generate the proxies all these types end up with redundant definitions in different namespaces. Worse, to invoke an operation in service2 that needs input obtained from service1, I have to waste time and space at run-time as well as write rather boring code like this:

<br />
public Service2.SomeType ToService2Type(Service1.SomeType obj)<br />
{<br />
   Service2.SomeType result = new Service2.SomeType();<br />
   // Primite types: Just copy, as they are defined outside the service namespace <br />
   // and we thus have type affinity.<br />
   result.Property1 = obj.Property1;<br />
   result.Property2 = obj.Property2;<br />
<br />
   // Anything else, "convert" between types that are really the same...<br />
   result.Property3 = ToService2Type(obj.Property3);<br />
   ...<br />
<br />
   return result;<br />
}<br />
<br />
public Service2.SomeOtherType ToService2Type(Service1.SomeOtherType)<br />
{<br />
   ...<br />
}<br />



Writing the code is a bore, but I think it's even worse that I cannot avoid the run-time overhead. I guess if I go into the generated proxy code I can change attributes all over the place and use the same types with both services where in fact they match the soap messages, but doing so would be even more of a chore and what if I need to regenerate the proxies some day?

I could perhaps write a separate app that uses reflection to discover the types and generate the code for all those ToService2Type methods, but that of course doesn't remove the run-time overhead.

Not quite as nice as I hoped this API...
GeneralRe: Generics, delegates and type inference Pin
Gideon Engelberth2-Oct-09 13:00
Gideon Engelberth2-Oct-09 13:00 
QuestionInheritance question Pin
xkrja1-Oct-09 23:35
xkrja1-Oct-09 23:35 
AnswerRe: Inheritance question Pin
stancrm1-Oct-09 23:49
stancrm1-Oct-09 23:49 
GeneralRe: Inheritance question Pin
xkrja2-Oct-09 0:22
xkrja2-Oct-09 0:22 
GeneralRe: Inheritance question Pin
Mirko19802-Oct-09 0:57
Mirko19802-Oct-09 0:57 
AnswerRe: Inheritance question Pin
Christian Graus2-Oct-09 0:40
protectorChristian Graus2-Oct-09 0:40 
AnswerRe: Inheritance question Pin
DaveyM692-Oct-09 0:46
professionalDaveyM692-Oct-09 0:46 
AnswerRe: Inheritance question Pin
dojohansen3-Oct-09 1:12
dojohansen3-Oct-09 1:12 
QuestionStream System Sound to A GSM MODEM Pin
aghoshbabu1-Oct-09 23:09
aghoshbabu1-Oct-09 23:09 
AnswerRe: Stream System Sound to A GSM MODEM Pin
Rutvik Dave2-Oct-09 4:27
professionalRutvik Dave2-Oct-09 4:27 
QuestionDotNetOpenMail Authentication Pin
DotNetCoderJunior1-Oct-09 22:52
DotNetCoderJunior1-Oct-09 22:52 
AnswerRe: DotNetOpenMail Authentication Pin
Christian Graus1-Oct-09 23:05
protectorChristian Graus1-Oct-09 23:05 
GeneralRe: DotNetOpenMail Authentication Pin
DotNetCoderJunior1-Oct-09 23:23
DotNetCoderJunior1-Oct-09 23:23 
GeneralRe: DotNetOpenMail Authentication Pin
Tom Deketelaere2-Oct-09 0:25
professionalTom Deketelaere2-Oct-09 0:25 
GeneralRe: DotNetOpenMail Authentication Pin
dojohansen3-Oct-09 1:18
dojohansen3-Oct-09 1:18 
GeneralRe: DotNetOpenMail Authentication Pin
Christian Graus2-Oct-09 0:41
protectorChristian Graus2-Oct-09 0:41 
JokeRe: DotNetOpenMail Authentication Pin
Tom Deketelaere2-Oct-09 2:27
professionalTom Deketelaere2-Oct-09 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.