Debate general Not WCF compatible

  • martes, 28 de junio de 2011 23:50
     
      Tiene código

    Hello,

    i am pretty new in WCF. So I don't understand why the WCF-Testclient cannot handle following Class. It is always telling me on methods, where I use followng class, that WCF-Testclient does not support this method, because of type GeoObject.

    public class GeoObject
      {
        [DataMember]
        public long Id;
    
        [DataMember]
        public int CreaterId;
    
        [DataMember]
        public System.DateTime CreationDate;
    
        [DataMember]
        public Dictionary<String, PropertyValueObject> Properties;
        
        [DataMember]
        public System.Nullable<double> Longitude;
    
        [DataMember]
        public System.Nullable<double> Latitude;
    
        [DataMember]
        public System.DateTime LastUpdate;
    
        [DataMember]
        public VisibleState VisibleState;
    
       
        public GeoObject()
        {
         // [...]
        }
    
        
        public Dictionary<String, PropertyValueObject> getAllPropertiesWithoutSublists()
        {
         // [...]
        }
    
      
        protected Dictionary<String, PropertyValueObject> getSubPropertiesWithoutSublists(Dictionary<String, PropertyValueObject> parent)
        {
         // [...]
        }
      }
    

    If I add some datamembers it is not changing. But I think I tried all datamembers in another class in similar way, and was working.

    Thanks for any help.

Todas las respuestas

  • miércoles, 29 de junio de 2011 8:07
     
     

    1. Da fehlt das DataContract Attibute über der Klassen Deklaration.
    2. Worher kommt das PropertyValueObject? Wenn es deine eigene Klasse ist, muss diese auch mit den Data... Attributen versehen werden.


  • miércoles, 29 de junio de 2011 9:20
     
      Tiene código

    Hallo, danke für die Antwort. Leider hab ich hier zuviel gekürzt. Vor beiden public class GeoObject/PropertyValueObject steht
        [DataContract]

    wie auch bei anderen Klassen auch. Hier nochmal PVO:

     public class PropertyValueObject
      {
        private PropertyTypeEnum _valueType;
        [DataMember]
        public PropertyTypeEnum ValueType 
        {
          get { return this._valueType; }
          set { this._valueType = value; }
        }
        
        private long _propertyObjectId;
        [DataMember]
        public long PropertyObjectId
        {
          get { return this._propertyObjectId; }
          set { this._propertyObjectId = value; }
        }
    
    
        private Object _propertyValue;
        [DataMember]
        public Object PropertyValue
        {
          get 
          {
            [...]
    
            return retValue;
          }
    
          set { this._propertyValue = value; }
        }
      }
    


  • jueves, 30 de junio de 2011 6:46
     
     
    Teste mal [DataContract(IsReference=true)] über die Klassen und teste es nochmal.