This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = new Person(name: "James", age: 27); | |
var update = new PersonUpdate { age = 28 }; | |
var changes = Map.MapWithChanges(update, person); // Theoretical API | |
if(changes.Any()) | |
_db.Save(person); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LazyDictionary<TKey, TValue> | |
{ | |
private readonly Func<TKey, TValue> _factory; | |
private readonly Dictionary<TKey, TValue> _cache; | |
public LazyDictionary(Func<TKey, TValue> factory) | |
{ | |
_factory = factory; | |
_cache = new Dictionary<TKey, TValue>(); | |
} |
NewerOlder