TechTalk Genome Wire Object Protocol v4.2

<Extends> Element

Extends the view definition with the serialization information defined for another view.

<View name=" view " type=" type ">
<Extends view=" base-view " />
A name identifying the serialization view.
A type specifying a persistent class.
A view defined on type or one of its base types.


<Extends> element can be used to extend the view with the serialization information defined in base-view. Multiple <Extends> elements can be specifed for each view. The serializer will always take the union of all fields declared on the view itself and on the views being extended.

When two extended views provide a declaration for the same reference or collection property the related persistent objects will be serialized with the union of the views defined in the extended views.

On every <Member> element of the view, the same filter and order clause have to be defined as for the corresponding <Member> element on the base-view (or none, if none was defined on the <Member> element of the base-view).


public abstract class Animal : Persistent {

    public abstract Guid Id { get; set; }
    public abstract string Name { get; set; }
    public abstract TaxonomyClass Class { get; set; }
    public abstract int Age { get; set; }
    public abstract Cage Cage { get; set; }

public abstract class Cage : Persistent {
        public abstract Guid Id { get; set; }
        public abstract string Name { get; set; }
        public abstract int Size { get; set; }

        public abstract Set Inhabitants
            [return: ElementType(typeof(Animal))]
<WireObjectProtocol xmlns="urn:TechTalk:Genome.Wop.Definition">
    <Using namespace="Zoo"/>

    <View name="ListItem" type="Animal">
        <Member name="Name" />
        <Member name="Class" />

    <View name="WithCage" type="Animal">
        <Member name="Name" />

        <Member name="Cage">
            <Member name="Name" />
            <Member name="Size" />
    <View name="Full" type=Animal>
        <Extends view="ListItem" />
        <Extends view="WithCage" />
        <Member name="Age" />
using Zoo;
using Zoo.Dto;                  
using Zoo.Dto.Serializers;
public class AnimalSerivces {

    public AnimalDto GetByName(string name) {
        using (Context.Push(ReadOnlyContext.Create())) {
            // do some business logic
            Animal animal = (Animal)DB.Extent(typeof(Animal))["Name = {0}", name].ToObject();
            // serializing the result to a DTO object with view "Full"
            return AnimalSerializer.SerializeFull(animal);
Transferred messages    
    <GetByNameResult xsi:type="AnimalDto">



Type: TechTalk.Genome.Wop.Definition.Builder.Xml.ExtendsXmlData

Assembly: TechTalk.Genome.Wop.dll

Version: 4.2.11

Editions: Professional, Community, Evaluation

See Also

<View> Element