Does generated WCF service client in Silverlight re-use the ChannelFactory? -
should 1 use generated wcf service client (e.g. myserviceclient) when invoking wcf service silverlight, or instead use channelfactory (e.g. channelfactory.create())?
other questions have asked question: wcf/silverlight: why use channelfactory instead of client?
however, responses it's best re-use channelfactory. if done directly, lose of other functionality of generated wcf service client (the async events, etc.)
is there no way generated wcf service client re-use channelfactory itself?
wcf fiasco
start_rant
even microsoft , wcf team know way channelfactory
, channel
, clientbase
designed , way changed because of various performance issues real fiasco. fact disposing of proxy real mess enough know underneath extensibility of wcf, dealing inefficent, bloated , convoluted design. bad bad bad.
end_rant
ok, have looked @ documentation assume have not been able find answers - did not - since there no easy answer. here findings summarises these points (you cannot find below in ms documentation):
1) have channelfactory
, ichannel
. channelfactory
knows how communicate transport , channel knows how interprete parameters wcf method calls , vice versa. ichannel
1 "implements" (or looks implementing) service interface while channelfactory has necessary abstractions communicating (including endpoint, security, ...).
2) clientbase
nothing both channelfactory
, ichannel
cobbled together. obvious creating channelfactory once , creating channels on , on means more efficient, howevere guessed not easy because ...
3) channelfactory
once opened, cannot changed. means if use username password connect wcf service , username password changes, need new one. might not seems big problem becomes big problem in asp net scenario.
4) channelfactory
, ichannel
in fact reuse same underlying communication channels closing channelfactory make ichannel invalid. causes confusion in clean code , decising responsiblity close connection.
5) see there no easy answer. if not have use username/password or change configuration @ runtime, create , cache channelfactory , create channels. in case channelfactory
, ichannel
more efficient clientbase
.
Comments
Post a Comment