Hi,
This might be a bit premature but here goes anyway....
I am passing a SmartDate in WCF
[
DataContract] public class RegulatedEntity{
public void AddDate(SmartDate date){
if (_dates == null){
_dates =
new List<SmartDate>();}
_dates.Add(date);
}
private string _name;[
DataMember] public string Name{
get { return _name; } set { _name = value; }}
private List<SmartDate> _dates;[
DataMember] public List<SmartDate> Dates{
get { return _dates; } set { _dates = value; }}
}
On the client side I bind with
cmbCOBDate.DisplayMember =
"Text";cmbCOBDate.DataSource = regEnt.Dates;
Where regEnt is an instance of RegulatedEntity. It appears that SmartDate.ToString is not been overridden and I get WinFormsClient.RegGAEService.SmartDate in stead of the formated date. _format is coming through fine.
Any ideas?
Thanks in advance
It is important to realize that on the client you do not have a SmartDate!!
WCF works just like web services: when you add a service reference, VS creates for you a whole set of types that have the same shape as the server types, but not the same behavior.
So no, ToString() is not overridden in the VS-generated proxy class being used by the client.
However, I think (am not sure) that those proxy classes are partial classes. So I think you can extend them, and so you could add a ToString() override in your partial class code.
But don't expect the client to have any of the other SmartDate behaviors either - date-to-text or text-to-date or empty value support or ... On the client you just have a data transfer object (DTO) that looks like, but doesn't act like, a SmartDate.
Thanks for that.
This leads me on to ask how does CSLA work with WCF when it only sends the data?
Copyright (c) Marimer LLC