/// <summary> /// Converts the given way to a redis way. /// </summary> /// <param name="way"></param> /// <returns></returns> public static RedisWay ConvertTo(Way way) { RedisWay redisWay = new RedisWay(); redisWay.Id = way.Id.Value; redisWay.ChangeSetId = way.ChangeSetId; redisWay.TimeStamp = way.TimeStamp; redisWay.UserId = way.UserId; redisWay.UserName = way.UserName; redisWay.Version = way.Version; redisWay.Visible = way.Visible; redisWay.Tags = PrimitiveExtensions.ConvertTo(way.Tags); if (way.Nodes != null) { redisWay.Nodes = new List<long>(way.Nodes); } return redisWay; }
/// <summary> /// Converts the given way from a redis way. /// </summary> /// <param name="redisWay"></param> /// <returns></returns> public static Way ConvertFrom(RedisWay redisWay) { Way way = new Way(); way.Id = redisWay.Id.Value; way.ChangeSetId = redisWay.ChangeSetId; way.TimeStamp = redisWay.TimeStamp; way.UserId = redisWay.UserId; way.UserName = redisWay.UserName; way.Version = redisWay.Version; way.Visible = redisWay.Visible; way.Tags = PrimitiveExtensions.ConvertFrom(redisWay.Tags); if (redisWay.Nodes != null) { way.Nodes = new List<long>(redisWay.Nodes); } return way; }