public void Save(Person person) { var client = new RedisClient(); var key = new PeopleKeys ().GetPersonKey (person.Id); var json = person.ToJson (); client.Set(key, json); var idManager = new DataIdManager (); idManager.Add (person); }
public Tile[] Get() { var idManager = new DataIdManager (); var ids = idManager.GetIds(typeof(Tile)); var tiles = new List<Tile> (); var reader = new TileReader (); foreach (Guid id in ids) { tiles.Add (reader.Read (id)); } return tiles.ToArray(); }
public DataSaver(GitDBSettings settings, DataTypeManager typeManager, DataIdManager idManager, DataPreparer preparer, DataLinker linker, DataChecker checker, Gitter gitter) : base(settings) { Settings = settings; IdManager = idManager; TypeManager = typeManager; Preparer = preparer; Checker = checker; Linker = linker; Gitter = gitter; Namer = new FileNamer (settings.Location); }
public TestContext() { DataClient = new MockRedisClientWrapper (); Settings = new DataManagerSettings (); Settings.IsVerbose = true; Keys = new DataKeys (Settings); IdManager = new DataIdManager (Keys, DataClient); TypeManager = new DataTypeManager (Keys, DataClient); EntityLinker = new EntityLinker (); var preparer = new DataPreparer (DataClient); Preparer = preparer; var reader = new DataReader (TypeManager, IdManager, Keys, DataClient); Reader = reader; var checker = new DataChecker (reader, Settings); Checker = checker; var saver = new DataSaver (Settings, TypeManager, IdManager, Keys, preparer, null, checker, DataClient); // The linker argument is null because it needs to be set after it's created below Saver = saver; var updater = new DataUpdater (Settings, Keys, null, preparer, checker, DataClient); // The linker argument is null because it needs to be set after it's created below Updater = updater; var linker = new DataLinker (Settings, reader, saver, updater, checker, EntityLinker); Linker = linker; // TODO: Is there a way to avoid this messy hack? // Make sure the linker is set to the saver and updater saver.Linker = linker; updater.Linker = linker; }