Implementing Generices in WFC?
Declaring service contract interfaces of type <T> does not seem to work when it comes to specifying the configuration in XML, especially the Contract tag does not like IContract<T>.
Interface IContract<T>
Void AddNew(T val)
ReadOnlyCollection<T> GetList()
MyServiceClass : IContract<Address>
.....
.....
.....
Specifying EndPoints Programatically works great but specifying in a config seems to crap out?
Is this a bug in WFC framework or its just by design that services should not be generic in nature?
[590 byte] By [
msdate] at [2007-12-25]
Specifying contract programatically always works, how-ever the web config part does not.
<system.serviceModel>
<services>
<service name="TestWindowsApplication.AddressList" behaviorConfiguration="metadataSupport">
<endpoint address="svc" binding="basicHttpBinding" contract="TestWindowsApplication.IContract<TestWindowsApplication.Address>"/>
<endpoint address="net.tcp://localhost:8081/Address/svc" binding="netTcpBinding" contract="TestWindowsApplication.IContract<TestWindowsApplication.Address>"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport" IncludeExceptionDetailInFaults="true">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Should'nt this work too ?
Thank you so much.
Use reflection to get the exact type of using GetType() function and specify the full name
UnderlyingSystemType: {Name = "IContract`1" FullName = "TestWindowsApplication.IContract`1[[TestWindowsApplication.Address, TestWindowsApplication, Version=1.0.2466.25199, Culture=neutral, PublicKeyToken=null]]"}
Speficy type as contract="TestWindowsApplication.IContract`1[[TestWindowsApplication.Address, TestWindowsApplication, Version=1.0.2466.25199, Culture=neutral, PublicKeyToken=null]]" and this rocks!!!