public Duck Get(DuckId id) { if (!_duckDictionary.ContainsKey(id.ToString())) { throw new NoDuckWithIdException(id.ToString()); } return(_converter.Convert(_duckDictionary[id.ToString()])); }
public Duck Convert(DuckRecord record) { return(new ReflectionBuilder <Duck>() .SetAutoPropety("Id", DuckId.FromExisiting(record.Id)) .SetField("_name", record.Name) .SetField("_age", record.Age) .Instance); }
public static Duck Create(string name, int age) => new Duck(DuckId.Generate(), name, age);
private Duck(DuckId id, string name, int age) { Id = id; _name = name; _age = age; }