Skip to content

sunriax/model

Repository files navigation

Version: 1.0 Release Version codecov License: GPL v3

Data models

Description

Simple data models that are often used in development and teaching.

PersonLib


Manual installation

Download library [zip | tar.gz] and unpack it to your project. Setup a reference and start using it in your project.

NuGet installation

NuGet

PM> Install-Package RaGae.Model.Person

Using Person

Person p = new();

Person p = new("Max", "Mustermann");

Person p = new()
{
    FirstName = "Max",
    LastName = "Mustermann"
};

p.FirstName;    // Max
p.LastName;     // Mustermann
p.ToString();   // Max Mustermann

Person c = (Person)p.Clone();

AddressLib


Manual installation

Download library [zip | tar.gz] and unpack it to your project. Setup a reference and start using it in your project.

NuGet installation

NuGet

PM> Install-Package RaGae.Model.Address

Using Address

Address a = new();

Address a = new("Musterstrasse", "1")
{
    City = new(1100, "Wien"),
    Country = new("AT", "Austria")  
};

Address a = new()
{
    Street = "Musterstrasse",
    Number = "1",
    City = new()
    {
        Zip = 1100,
        Name = "Wien"
    },
    Country = new()
    {
        Code = "AT",
        Name = "Austria"
    }
};

a.Street;               // Musterstrasse
a.Number;               // 1
a.ToString();           // Musterstrasse 1

a.City.Zip              // 1100
a.City.Name             // Wien
a.City.ToString();      // 1100 Wien

a.Country.Code          // AT
a.Country.Name          // Austria
a.Country.ToString();   // AT-Wien

Address c = (Address)a.Clone();

Using City

City c = new();

City c = new(1100, "Wien");

City c = new()
{
    Zip = 1100,
    Name = "Wien"
};

c.Zip;          // 1100
c.Name;         // Wien
c.ToString();   // 1100 Wien

City y = (City)c.Clone();

Using Country

Country c = new();

Country c = new("AT", "Austria");

Country c = new()
{
    Code = "AT",
    Name = "Austria"
};

c.Code;         // AT
c.Name;         // Austria
c.ToString();   // AT-Austria

Country y = (Country)c.Clone();

R. GÄCHTER