Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    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.
    1. COBaseClass is defined as you have noted. The Client simply derived from that class to take advantage of the generic List<> operators/methods; The implementation would work if the client simply went the has-a approach rather than a is-a approach; that is, if the client didn't derive from List<BaseClass> but rather made it a property. But this would look clunky. Is it necessary for the serivce to know about derived implementations of List<BaseClass>? Seems not, the client needs to send the List<BaseClass> over; the client derived clss should be hidden from serivce
      singulars
    2. COYou do not have to add it at the service contract AND the data contract level. One is enough. Another alternative is the configuration file or using the KnownTypeAttbibute .ctor that takes as parameter the name of a helper method returning an IEnumerable of known types. Anyway I can't see the point of your derived class. It makes your design harder to understand without any benefits (visible from your example and comments). Remove the derived class and use IList<T> or IEnumerable<T> in your service operations. This way you encapsulate the collection type and have simple maintainable code.
      singulars
    3. COThe derived class is purely to operate on the List<BaseClass> and that is it. Just helper functions. Like functions that operate on the List<BaseClass>; for example, Set all item properties of the list to a value given some conditions and to calculate some values against the List<BaseClass>. Basically, all the data and operations is contained in DerivedClass rather than having a seperate "Helper" class that we need to create each time we need to perform a common tasks. Now if you are to say that having two classes (Derived and Helper) is a good design, I disagree.
      singulars
 

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