예제 #1
0
        private static void addToMySql(ICollection<MagicalCreatureModel> list)
        {
            UpdateDatabaseMySql();
            var context = new FluentModel();

            var count = context.MagicalCreatures.Count();
            foreach (var item in list)
            {

                var obj = item;
                obj.Id = count;
                context.Add(item);
                count++;
            }
            context.SaveChanges();
        }
예제 #2
0
 private static void UpdateDatabaseMySql()
 {
     using (var context = new FluentModel())
     {
         var schemaHandler = context.GetSchemaHandler();
         EnsureDB(schemaHandler);
     }
 }