コード例 #1
0
        public void SetData(string serieName, DateTime date, decimal value)
        {
            using (var db = new DomoContext())
            {
                DataSerie serie = db.DataSerie.FirstOrDefault(e => e.Name.Equals(serieName));
                if (serie == null)
                {
                    return;
                }

                db.Sample.Add(new Sample {
                    Date = date, Value = value, SerieId = serie.Id
                });
                db.SaveChanges();
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            var dataDirectory         = ConfigurationManager.AppSettings["DataDirectory"];
            var absoluteDataDirectory = Path.GetFullPath(dataDirectory);

            AppDomain.CurrentDomain.SetData("DataDirectory", absoluteDataDirectory);
#if DEBUG
            using (var db = new DomoContext())
            {
                db.Database.CreateIfNotExists();
            }

            DomoCoreService.Run();
#else
            ServiceBase[] servicesToRun;
            servicesToRun = new ServiceBase[]
            {
                new DomoCoreService()
            };
            ServiceBase.Run(servicesToRun);
#endif
        }