Microsoft
Software
Hardware
Network
Question : WCF: Generic into a method?
Hi!
I've a method that should send back an object corresponding to an ID.
So, instead using X differents services or/and have a parameter indicating the type and typecasting the result, I wish I can have a WCF method that cant act like this:
[OperationContract]
T MyGenericOperation<T>(int id) ;
I tried but I get some errors:
SSystem.Runtime.Serializat
ion.Invali
dDataContr
actExcepti
on was unhandled
Message=Impossible d'importer le type 'T' comme type schéma car c'est un type générique ouvert. Un type générique est uniquement exportable si tous ses types de paramètres génériques sont des types réels.
(google translate: Unable to import the type 'T' as a type scheme because it is a generic open. A generic type is only exportable if all its generic parameter types are actual types. )
So is it possible? Do I something wrong?
Thank you
Answer : WCF: Generic into a method?
With WCF service, the type should be concrete and cannot immutable. Unfortunately T doesn't work well with WCF
Random Solutions
PfSense Captive Portal / VmWare HELP
ISA PPTP VPN connection not working
Slipstream all updates into new wim.image / win 7 install DVD
NAT setting and vmware
Exchange 2010 Rollup 3 Issues
Small Business Server Crital alerts
how to indent a block of text
DataBinding: 'System.Data.Common.DataRe
cordIntern
al' does not contain a property with the name 'IdKeuze'.
Q945119 - storport.sys 5.2.3790.4189
Error: "The site <sitename> could not be found in the Web application SPWebApplication Name=MOSS Parent=SPWebService"