private static void ImportFareAttribute(MongoDatabase database, FileInfo getFareAttribute) { var fareAttribute = database.GetCollection <FareAttribute>(getFareAttribute.Name); fareAttribute.InsertBatch(Associator <FareAttribute> .Read(new StreamReader(getFareAttribute.OpenRead()))); fareAttribute.CreateIndex("fare_id"); }
private static void ImportCalendar(MongoDatabase database, FileInfo getFile) { var calendar = database.GetCollection <Calendar>("calendar"); calendar.InsertBatch(Associator <Calendar> .Read(new StreamReader(getFile.OpenRead()))); calendar.CreateIndex("service_id"); }
private static void ImportShape(MongoDatabase database, FileInfo getShape) { var shape = database.GetCollection <Shape>(getShape.Name); shape.InsertBatch(Associator <Shape> .Read(new StreamReader(getShape.OpenRead()))); shape.CreateIndex("shape_id", "shape_sequence"); }
private static void ImportFrequency(MongoDatabase database, FileInfo getFrequency) { var shape = database.GetCollection <Frequency>(getFrequency.Name); shape.InsertBatch(Associator <Frequency> .Read(new StreamReader(getFrequency.OpenRead()))); shape.CreateIndex("trip_id"); }
private static void ImportTransfer(MongoDatabase database, FileInfo getTransfer) { var shape = database.GetCollection <Transfer>(getTransfer.Name); shape.InsertBatch(Associator <Transfer> .Read(new StreamReader(getTransfer.OpenRead()))); shape.CreateIndex("from_stop_id", "to_stop_id"); }
public static IEnumerable <T> Read(StreamReader reader) { var log = LogManager.GetCurrentClassLogger(); log.DebugFormat("Thread {0}: Start Importing {1}", Thread.CurrentThread.ManagedThreadId, typeof(T).Name); var associator = new Associator <T>(reader.ReadLine()); var items = 0; while (!reader.EndOfStream) { var line = reader.ReadLine(); if (string.IsNullOrEmpty(line)) { continue; } yield return(associator.Associate(new T(), line)); items++; if (items % 250 == 0) { log.DebugFormat("Thread {0}: Importing {1}: {2} items imported.", Thread.CurrentThread.ManagedThreadId, typeof(T).Name, items); } } log.DebugFormat("Thread {0}: End import of {1}. {2} items imported.", Thread.CurrentThread.ManagedThreadId, typeof(T).Name, items); }
private static void ImportStopTimes(MongoDatabase database, FileInfo getFile) { var stopTimes = database.GetCollection <StopTime>("stop_times"); stopTimes.InsertBatch(Associator <StopTime> .Read(new StreamReader(getFile.OpenRead()))); stopTimes.CreateIndex("trip_id"); stopTimes.CreateIndex("trip_id", "stop_id", "stop_sequence"); }
private static async Task ImportCalendar(IMongoDatabase database, FileInfo getFile) { var calendar = database.GetCollection <Calendar>("calendar"); await calendar.InsertManyAsync(Associator <Calendar> .Read(new StreamReader(getFile.OpenRead()))); await calendar.Indexes.CreateOneAsync(new CreateIndexModel <Calendar>( Builders <Calendar> .IndexKeys.Ascending(t => t.ServiceID))); }
private static void ImportStop(MongoDatabase database, FileInfo fileInfo) { var stops = database.GetCollection <Stop>("stops"); stops.InsertBatch(Associator <Stop> .Read(new StreamReader(fileInfo.OpenRead()))); stops.CreateIndex("StopId"); stops.CreateIndex("StopLatLon"); }
private static async Task ImportFrequency(IMongoDatabase database, FileInfo getFrequency) { var shape = database.GetCollection <Frequency>(getFrequency.Name); await shape.InsertManyAsync(Associator <Frequency> .Read(new StreamReader(getFrequency.OpenRead()))); await shape.Indexes.CreateOneAsync(new CreateIndexModel <Frequency>( Builders <Frequency> .IndexKeys.Ascending(t => t.TripId))); }
private static async Task ImportFareAttribute(IMongoDatabase database, FileInfo getFareAttribute) { var fareAttribute = database.GetCollection <FareAttribute>(getFareAttribute.Name); await fareAttribute.InsertManyAsync(Associator <FareAttribute> .Read(new StreamReader(getFareAttribute.OpenRead()))); await fareAttribute.Indexes.CreateOneAsync(new CreateIndexModel <FareAttribute>( Builders <FareAttribute> .IndexKeys.Ascending(t => t.FareId))); }
private static async Task ImportFareRule(IMongoDatabase database, FileInfo getFareRule) { var fareRule = database.GetCollection <FareRule>(getFareRule.Name); await fareRule.InsertManyAsync(Associator <FareRule> .Read(new StreamReader(getFareRule.OpenRead()))); var bldr = Builders <FareRule> .IndexKeys; await fareRule.Indexes.CreateOneAsync(new CreateIndexModel <FareRule>( bldr.Combine(bldr.Ascending(t => t.FareId), bldr.Ascending(t => t.RouteId)))); }
private static async Task ImportStop(IMongoDatabase database, FileInfo fileInfo) { var stops = database.GetCollection <Stop>("stops"); await stops.InsertManyAsync(Associator <Stop> .Read(new StreamReader(fileInfo.OpenRead()))); await stops.Indexes.CreateOneAsync(new CreateIndexModel <Stop>(Builders <Stop> .IndexKeys.Ascending(t => t.StopId))); await stops.Indexes.CreateOneAsync(new CreateIndexModel <Stop>(Builders <Stop> .IndexKeys.Ascending(t => t.StopLatLon))); }
private static async Task ImportShape(IMongoDatabase database, FileInfo getShape) { var shape = database.GetCollection <Shape>(getShape.Name); await shape.InsertManyAsync(Associator <Shape> .Read(new StreamReader(getShape.OpenRead()))); var bldr = Builders <Shape> .IndexKeys; await shape.Indexes.CreateOneAsync(new CreateIndexModel <Shape>( bldr.Combine(bldr.Ascending(t => t.ShapeID), bldr.Ascending(t => t.ShapePointSequence)))); }
private static async Task ImportTransfer(IMongoDatabase database, FileInfo getTransfer) { var shape = database.GetCollection <Transfer>(getTransfer.Name); await shape.InsertManyAsync(Associator <Transfer> .Read(new StreamReader(getTransfer.OpenRead()))); var bldr = Builders <Transfer> .IndexKeys; await shape.Indexes.CreateOneAsync(new CreateIndexModel <Transfer>( bldr.Combine(bldr.Ascending(t => t.FromStopId), bldr.Ascending(t => t.ToStopId)))); }
private static async Task ImportStopTimes(IMongoDatabase database, FileInfo getFile) { var stopTimes = database.GetCollection <StopTime>("stop_times"); await stopTimes.InsertManyAsync(Associator <StopTime> .Read(new StreamReader(getFile.OpenRead()))); var bldr = Builders <StopTime> .IndexKeys; await stopTimes.Indexes.CreateOneAsync(new CreateIndexModel <StopTime>(bldr.Ascending(t => t.TripId))); await stopTimes.Indexes.CreateOneAsync(new CreateIndexModel <StopTime>(bldr.Combine( bldr.Ascending(t => t.TripId), bldr.Ascending(t => t.StopId), bldr.Ascending(t => t.StopSequence)))); }
private static void ImportFeedInfo(MongoDatabase database, FileInfo getFeedInfo) { var feedInfo = database.GetCollection <FeedInfo>(getFeedInfo.Name); feedInfo.InsertBatch(Associator <FeedInfo> .Read(new StreamReader(getFeedInfo.OpenRead()))); }
private static void ImportTrip(MongoDatabase database, FileInfo fileInfo) { var routes = database.GetCollection("trips"); routes.InsertBatch(Associator <Trip> .Read(new StreamReader(fileInfo.OpenRead()))); }
private static async Task ImportTrip(IMongoDatabase database, FileInfo fileInfo) { var routes = database.GetCollection <Trip>("trips"); await routes.InsertManyAsync(Associator <Trip> .Read(new StreamReader(fileInfo.OpenRead()))); }
private static void ImportAgency(MongoDatabase database, FileInfo fileInfo) { var agencies = database.GetCollection <Agency>("agency"); agencies.InsertBatch(Associator <Agency> .Read(new StreamReader(fileInfo.OpenRead()))); }
private static async Task ImportAgency(IMongoDatabase database, FileInfo fileInfo) { var agencies = database.GetCollection <Agency>("agency"); await agencies.InsertManyAsync(Associator <Agency> .Read(new StreamReader(fileInfo.OpenRead()))); }
private static async Task ImportFeedInfo(IMongoDatabase database, FileInfo getFeedInfo) { var feedInfo = database.GetCollection <FeedInfo>(getFeedInfo.Name); await feedInfo.InsertManyAsync(Associator <FeedInfo> .Read(new StreamReader(getFeedInfo.OpenRead()))); }