The domain

Saturday, 31 October 2009
So I've set the environment. It's time to set the work model. Because I like monkeys and monkeys love bananas, I will start from the banana entity. Bananas are fruits and usually fruits stay in trees. So here's my model. Of course, I have to keep my data in a db, so all my entities must have Ids:


public enum FruitType {
Banana,
Mango,
Orange
}

public class Fruit {
public int Id { get; set; }

public FruitType Type { get; set; }

public int TreeId { get; set; }

public Tree Tree { get; set; }
}

public class Tree {
public int Id { get; set; }

public IList<Fruit> Fruits { get; set; }

public string Name { get; set; }
}


So this is my domain from now on. I have a simple enum and two entities in a one to many relationship. Simple enough!

0 comments:

Post a Comment