Saturday, 15 September 2012

c# - How to compile a class type dynamically only once? -



c# - How to compile a class type dynamically only once? -

i deploying client app mobile laptop configured utilize 1 of 2 network servers. network servers identical different ip addresses each in different office.

when client app first started, needs determine 1 time office in , hence dataservice connect to. so, using client machine's ip address, wish this:

internal type??? dataservice = new resolvedataservice(); novadataserviceclient resolvedataservice() { if (localip == xxx.xxx.xxx.xxx) { retrun new dataservice.novadataserviceclient(); } else { homecoming new librarywebservice.novadataserviceclient(); } }

furthermore, since has done once, static constructor preferred. real problem namespace "dataservice" , "librarywebservice" given add together service reference of client project in above code

internal type??? dataservice

the type not known until resolvedataservice called.

how done correctly? thanks

if these 2 services same , differ ip address right thing have 1 service reference , set endpoint when create service. easiest way in case add together sec endpoint configuration different name attribute app.config , supply in client's constructor.

c# wcf iis

No comments:

Post a Comment