main
1using Gorilla.Commons.Infrastructure.Cloning;
2using gorilla.commons.utility;
3
4namespace momoney.database.transactions
5{
6 public interface ITrackerEntryMapper<T> : Mapper<T, ITrackerEntry<T>> {}
7
8 public class TrackerEntryMapper<T> : ITrackerEntryMapper<T>
9 {
10 readonly IPrototype prototype;
11
12 public TrackerEntryMapper(IPrototype prototype)
13 {
14 this.prototype = prototype;
15 }
16
17 public ITrackerEntry<T> map_from(T item)
18 {
19 return new TrackerEntry<T>(create_prototype(item), item);
20 }
21
22 T create_prototype(T item)
23 {
24 return prototype.clone(item);
25 }
26 }
27}