示例#1
0
        public bool Initialize(IConfig cfg)
        {
            config = cfg;

            //model = new vhackdbEntities(config.dbConnectionString);
            model = new vhackdbEntities();

            var splits = DbVersion.Split('.');
            var major  = Convert.ToInt32(splits[0]);
            var minor  = Convert.ToInt32(splits[1]);
            var patch  = Convert.ToInt32(splits[2]);

            try
            {
                var lastVersion = model.Version
                                  .ToArray()
                                  .Last();

                // TODO: update db if necessary
            }
            catch (Exception e)
            {
                config.logger.Log("Cannot read database version: {0}", e.Message);
                return(false);
            }

            return(true);
        }
示例#2
0
 public void Update() => model = new vhackdbEntities();