BuildFeed/RedisMongoMigration/Program.cs

60 lines
1.9 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MBuildModel = RedisMongoMigration.Mongo.BuildModel;
using MBuild = RedisMongoMigration.Mongo.Build;
using RBuild = RedisMongoMigration.Redis.Build;
2015-09-12 22:23:13 +08:00
using MongoLevelOfFlight = RedisMongoMigration.Mongo.MongoLevelOfFlight;
using RedisLevelOfFlight = RedisMongoMigration.Redis.RedisLevelOfFlight;
namespace RedisMongoMigration
{
class Program
{
static void Main(string[] args)
{
var builds = RBuild.Select();
var newBuilds = from b in builds
select new MBuildModel()
{
Id = Guid.NewGuid(),
LegacyId = b.Id,
MajorVersion = b.MajorVersion,
MinorVersion = b.MinorVersion,
Number = b.Number,
Revision = b.Revision,
Lab = b.Lab,
BuildTime = b.BuildTime,
Added = b.Added,
Modified = b.Modified,
SourceType = b.SourceType,
SourceDetails = b.SourceDetails,
LeakDate = b.LeakDate,
2015-09-12 22:23:13 +08:00
FlightLevel = ExchangeFlights(b.FlightLevel)
};
MBuild m = new MBuild();
m.InsertAll(newBuilds);
Console.WriteLine("Builds: Complete");
Console.ReadKey();
}
2015-09-12 22:23:13 +08:00
static MongoLevelOfFlight ExchangeFlights(RedisLevelOfFlight flight)
{
switch (flight)
{
case RedisLevelOfFlight.Low:
return MongoLevelOfFlight.WIS;
case RedisLevelOfFlight.High:
return MongoLevelOfFlight.OSG;
default:
return MongoLevelOfFlight.None;
}
}
}
}