I have a CibilResponse Class that has properties that are of class type (TUEF class).
I am trying to assign values using : CibilEnquiryEnq.Tuef.Version = \"12\
The proxy objects generated by adding a service reference are not the same objects as you are defining in the service contract, they just happen to be created within the same namespace etc under the consuming clients service reference. Basically they are just DTOs that you use to consume the service.
If you want to have strong dependency between the objects then you can not use the service reference and you need to extract the contract to a separate assembly that you can reference.
1) CibilWcfService.Contract - contains the ICIBIL interface + datacontract objects. You need to reference System.ServiceModel, System.ServiceModel.Web and System.Runtime.Serialization for DataContract related attributes.
2) CibilWcfService - This hosts the WCF service and refers the CibilWcfService.Contract assembly.
namespace CibilWcfService
{
using CibilWcfService.Contract;
public class CibilService : ICIBIL
{
// ... Interface implementation
}
}
3) CibilClient - This is your consuming client application, it also refers the CibilWcfService.Contract assembly. You create the channel to the service like this, then the new CibilEnquiry() is using the same constructor as defined in your contract. You need to reference System.ServiceModel for ChannelFactory.
using CibilWcfService.Contract;
var cf = new ChannelFactory();
var channel = cf.CreateChannel(new EndpointAddress("http://127.0.01/CibilServiceUri"));
if (channel != null)
{
var CibilEnquiryEnq = new CibilEnquiry();
CibilEnquiryEnq.Tuef.Version = "1111";
channel.GenerateEnquiry(CibilEnquiryEnq);
}