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(); }
private static void UpdateDatabaseMySql() { using (var context = new FluentModel()) { var schemaHandler = context.GetSchemaHandler(); EnsureDB(schemaHandler); } }