Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF call fails when serialize base class which is a generic List<>
    primarykey
    data
    text
    <p>I have the following structure:</p> <pre><code>public class DerivedClass : List&lt;BaseClass&gt; { //Some helper methods used against the List of BaseClass properties //Methods public List&lt;BaseClass&gt; GetListOfBaseClasses() { return (List&lt;BaseClass&gt;)this; } } </code></pre> <p>My WCF service knows about the BaseClass object, but the client derived it as a generic list, now when I try to call the service, like this:</p> <pre><code>DerivedClass classD; FillData(classD) List&lt;BaseClass&gt; baseClassList = classD.GetListOfBaseClasses(); using (IService myService = ObjectFactory.GetMyService()) { myService.DoSomething(baseClassList); //Method is expecting "List&lt;BaseClass&gt;" } </code></pre> <p>I get the following exception:</p> <blockquote> <p>Type 'DerivedClass' with data contract name '[some URI text]' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.</p> </blockquote> <p>I tried adding these attributes to my class in various combinations but still no luck:</p> <pre><code>[Serializable] [KnownType(typeof(List&lt;BaseClass&gt;))] [XmlInclude(typeof(List&lt;BaseClass&gt;))] [KnownType(typeof(BaseClass))] [XmlInclude(typeof(BaseClass))] public class DerivedClass : List&lt;BaseClass&gt; { /// ... } </code></pre> <p>PS- Sheehs, am I the only one that thinks the entry fields are funky on this site? Things keep moving around as I try to format... :| great site regardless of my inability to get the idea of entering text as I want. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload