Skip to content

Legacy Estate Model Reference

Legacy Model - For Reference Only

This model is deprecated and should only be used for understanding the old XML structure and for migration purposes. For all new development, use the new Estate model.

Overview

The legacy model is a direct C# representation of the Vitec/Webmegler XML structure. It was created specifically for that system and has several design issues:

  • Over 100 flat properties with no logical grouping
  • Norwegian field names (not international)
  • Platform-specific fields (Finn.no, Tinde, Zett)
  • Bloated image structure (10 properties per image)
  • Mixed concerns (property data + presentation URLs + department info)
  • No type safety (strings everywhere)

Problems Illustrated

Problem 1: Flat Structure (100+ Properties)

public class LegacyEneiendom
{
    // IDs
    public long Id { get; set; }
    public long Databasenummer { get; set; }
    public long IdAvdelinger { get; set; }
    public long IdFirma { get; set; }
    public long Oppdragsnummer { get; set; }

    // Address (7 separate properties!)
    public string Adresse { get; set; }
    public string Postnummer { get; set; }
    public string Poststed { get; set; }
    public string Kommune { get; set; }
    public string Fylke { get; set; }
    public string Bydel { get; set; }
    public string Land { get; set; }

    // Areas (multiple overlapping fields)
    public decimal? PrimaerrromAreal { get; set; }
    public decimal? BruksaReal { get; set; }
    public decimal? BruttoareaL { get; set; }
    public decimal? AnnenAreal { get; set; }
    public decimal? Tomteareal { get; set; }

    // ... 90+ more properties at the same level!
}

Comparison with new model:

// New model - organized and clear
public class Estate
{
    public Address Address { get; set; }  // All address info in one object
    public PropertyDetails Details { get; set; }  // All areas in one object
}

Problem 2: Platform-Specific Fields

// Legacy - Separate fields for each platform
public string FinnEiendomstype { get; set; }
public string FinnOppdragstype { get; set; }
public string FinnEierformBygninger { get; set; }
public string FinnOrderno { get; set; }
public string KundenummerFinn { get; set; }

public string TindeOppdragstype { get; set; }
public string TindeEiendomstype { get; set; }
public string TindeEierformBygninger { get; set; }

public string KundenummerZett { get; set; }

Comparison with new model:

// New model - system independent
public string Origin { get; set; }  // "Vitec", "Other"
public PropertyType PropertyType { get; set; }  // Universal enum
public Dictionary<string, object> CustomData { get; set; }  // For truly system-specific data

Problem 3: Bloated Image Structure

// Legacy - 10 properties per image!
public class LegacyBilde
{
    public string UrlThumbnail { get; set; }
    public string ThumbnailFil { get; set; }
    public string UrlLiteBilde { get; set; }
    public string LiteBildeFil { get; set; }
    public string UrlStandardBilde { get; set; }
    public string StandardBildeFil { get; set; }
    public string UrlStorThumbnail { get; set; }
    public string StorThumbnailFil { get; set; }
    public string UrlOriginalBilde { get; set; }
    public string OriginalBildeFil { get; set; }
    // Plus metadata...
}

Comparison with new model:

// New model - clean and simple
public class Image
{
    public string Id { get; set; }
    public string OriginalUrl { get; set; }
    public string Filename { get; set; }
    public string FileExtension { get; set; }
    public string Caption { get; set; }
    public string AltText { get; set; }
    public string Category { get; set; }  // "Facade", "Interior", "Kitchen"
    public int Order { get; set; }
    public int Width { get; set; }
    public int Height { get; set; }
}

Note: The Image class is shared across all entities (Estate, Department, Agent, HousingProject).

Problem 4: Norwegian Field Names

// Legacy - Norwegian names
public string Postnummer { get; set; }      // Postal code
public string Poststed { get; set; }        // City
public int? Byggeaar { get; set; }          // Year built
public decimal? Tomteareal { get; set; }    // Plot area
public decimal? Primaerrrom { get; set; }   // Primary room
public decimal? Bruksareal { get; set; }    // Usable area
public string Oppvarming { get; set; }      // Heating

Comparison with new model:

// New model - International English
public string PostalCode { get; set; }
public string City { get; set; }
public int? YearBuilt { get; set; }
public decimal? PlotArea { get; set; }
public decimal? PrimaryRoomArea { get; set; }
public decimal? UsableArea { get; set; }

Problem 5: Mixed Concerns

// Legacy - Everything in one class
public class LegacyEneiendom
{
    // Property data
    public string Adresse { get; set; }
    public decimal? Prisantydning { get; set; }

    // Presentation URLs (shouldn't be in data model!)
    public string UrlNettversjon { get; set; }
    public string HttpLinkOppdrag { get; set; }

    // Department info (should be separate object)
    public string AvdelingNavn { get; set; }
    public string AvdelingFagansvarligNavn { get; set; }
    public string AvdelingFagansvarligEmail { get; set; }

    // System state (mixed with data)
    public bool Markedsforingsklart { get; set; }
    public long Markedsforingversjon { get; set; }
}

Comparison with new model:

// New model - Separation of concerns
public class Estate
{
    // Property data
    public Address Address { get; set; }
    public PriceInfo Price { get; set; }

    // People (separate objects)
    public Department Department { get; set; }
    public Agent PrimaryAgent { get; set; }

    // External URLs (separate object)
    public ExternalPlatformUrls ExternalUrls { get; set; }
}

Problem 6: No Type Safety

// Legacy - Everything is strings
public string TypeOppdrag { get; set; }           // "01.Salg eiendom"
public string TypeEiendomstyper { get; set; }     // "Næringsbygg"
public string TypeEierformBygninger { get; set; } // "Selveier"
public string Oppvarming { get; set; }            // Free text

Comparison with new model:

// New model - Type-safe enums
public enum PropertyType
{
    Residential,
    Commercial,
    Industrial
}

public enum OwnershipType
{
    Freehold,
    Cooperative,
    Condominium
}

Complete Legacy Structure

Main Class

[XmlRoot("eiendommer")]
public class LegacyEiendommer
{
    [XmlElement("eneiendom")]
    public LegacyEneiendom Eneiendom { get; set; }
}

public class LegacyEneiendom
{
    // Core IDs (5 different ID fields!)
    public long Id { get; set; }
    public long Databasenummer { get; set; }
    public long IdAvdelinger { get; set; }
    public long IdFirma { get; set; }
    public long Oppdragsnummer { get; set; }

    // Boolean flags (10+ flags)
    public bool Arkivert { get; set; }
    public bool Trukket { get; set; }
    public bool Solgt { get; set; }
    public bool Markedsforingsklart { get; set; }
    // ... more flags

    // Platform-specific fields (15+ fields)
    public string FinnEiendomstype { get; set; }
    public string TindeEiendomstype { get; set; }
    public string KundenummerZett { get; set; }
    // ... more platform fields

    // Address fields (7 separate properties)
    public string Adresse { get; set; }
    public string Postnummer { get; set; }
    public string Poststed { get; set; }
    // ... more address fields

    // Department/Department info (20+ properties mixed in!)
    public string AvdelingNavn { get; set; }
    public string AvdelingFagansvarligNavn { get; set; }
    // ... more department fields

    // Areas (5+ overlapping area fields)
    public decimal? PrimaerrromAreal { get; set; }
    public decimal? BruksaReal { get; set; }
    public decimal? Tomteareal { get; set; }
    // ... more area fields

    // Pricing (10+ price-related fields)
    public decimal? Prisantydning { get; set; }
    public decimal? Fellesgjeld { get; set; }
    public decimal? Felleskostnader { get; set; }
    // ... more price fields

    // Descriptions (6+ description fields)
    public string Beskrivelse { get; set; }
    public string BeskrivelseBolig { get; set; }
    public string BeskrivelseBeliggenhet { get; set; }
    // ... more description fields

    // Collections
    public List<LegacyBilde> Bilder { get; set; }
    public List<LegacyDokument> Dokumenter { get; set; }
    public List<LegacyVisning> Visninger { get; set; }
    public List<LegacyLenke> Lenker { get; set; }

    // ... 50+ more properties!
}

Supporting Classes

// Image class - bloated with duplicate info
public class LegacyBilde
{
    public long Id { get; set; }
    public string UrlThumbnail { get; set; }
    public string ThumbnailFil { get; set; }        // Duplicate!
    public string UrlLiteBilde { get; set; }
    public string LiteBildeFil { get; set; }        // Duplicate!
    public string UrlStandardBilde { get; set; }
    public string StandardBildeFil { get; set; }    // Duplicate!
    public string UrlStorThumbnail { get; set; }
    public string StorThumbnailFil { get; set; }    // Duplicate!
    public string UrlOriginalBilde { get; set; }
    public string OriginalBildeFil { get; set; }    // Duplicate!
}

// KID codes (Norwegian payment system - very specific!)
public class LegacyKlientkonto
{
    public string Kontonummer { get; set; }
    public List<LegacyKid> Kids { get; set; }
}

public class LegacyKid
{
    public int Id { get; set; }
    public string Type { get; set; }  // INNBETALING_FRA_SELGER, etc.
    public string Kode { get; set; }
}

XML Example

Here's what the XML looks like (abbreviated):

<eiendommer>
  <eneiendom>
    <felt navn="id">3221523</felt>
    <felt navn="oppdragsnummer">110250256</felt>
    <felt navn="type_eiendomstyper">Næringsbygg</felt>
    <felt navn="finn_eiendomstype">Industri</felt>
    <felt navn="tinde_eiendomstype">Næringsbygg</felt>
    <felt navn="adresse">Industriveien 25</felt>
    <felt navn="postnummer">1400</felt>
    <felt navn="avdeling_navn">Proaktiv - Meglerhuset Borg Næring</felt>
    <felt navn="avdeling_fagansvarlig_navn">Karianne Westby Jensen</felt>
    <!-- 100+ more fields... -->
  </eneiendom>
</eiendommer>

Why We're Replacing It

Issue Impact New Model Solution
100+ flat properties Hard to navigate and understand Organized into 8 logical groups
Norwegian names Not international English naming
Platform-specific Cannot reuse with other systems System-independent design
Bloated images 10 properties per image 4 clean URLs per image
Mixed concerns Property + Department + URLs all together Separated into different classes
No type safety Easy to make mistakes Enums and strong typing

Migration Strategy

To migrate from legacy to new model:

  1. Create a mapper class that converts LegacyEneiendomEstate
  2. Map standard fields to the new structure
  3. Store truly system-specific data in CustomData
  4. Test thoroughly with real Vitec data
  5. Deprecate the legacy model once migration is complete

See the comparison page for detailed migration guidance.

Download