static void Main(string[] args) { using(var file=new StreamReader(args[0])) { RedisServer redis = new RedisServer(); ModelProducer producer = new ModelProducer(); Stopwatch s_watch = new Stopwatch(); ReputationBase db=new ReputationBase(ConfigurationSettings.AppSettings["MainBase"]); int count = 0; string stat = ""; while(!file.EndOfStream) { s_watch.Start(); string line = file.ReadLine(); long Id=Convert.ToInt64(line); s_watch.Stop(); stat += s_watch.ElapsedTicks + "/"; s_watch.Reset(); s_watch.Start(); var company = db.GetCompany(Id);//получение общей информации о компании s_watch.Stop(); stat += s_watch.ElapsedTicks + "/"; s_watch.Reset(); if (company == null) continue; s_watch.Start(); var relations = db.GetRelations(Id); s_watch.Stop(); stat += s_watch.ElapsedTicks + "/"; s_watch.Reset(); s_watch.Start(); redis.SetCompany(company); redis.SetRelations(Id, relations); s_watch.Stop(); stat += s_watch.ElapsedTicks + "/"; s_watch.Reset(); count++; if (count % 100 == 0) Console.WriteLine(count+", statistics: "+stat); stat = ""; } } }
public ModelProducer() { db = new ReputationBase(ConfigurationSettings.AppSettings["MainBase"]); }