Documentation Bulk Update/Insert does not work #84

Closed
erolnicki opened this Issue Sep 10, 2011 · 2 comments

Projects

None yet

2 participants

@erolnicki

I set up the code according to the front page docs, and set up a sql server express table Products with appropriate columns to test the code

var table = new Products();
//OH NO YOU DIDN't just pass in an integer inline without a parameter!
//I think I might have... yes
var drinks = table.All("WHERE CategoryID = 8");
//what we get back here is an IEnumerable < ExpandoObject > - we can go to town
foreach(var item in drinks){
//turn them into Haack Snacks
item.CategoryID = 12;
}
//Let's update these in bulk, in a transaction shall we?
table.Save(drinks);

This throws an error @ line 400 within Massive.cs v 100644 from Aug 31.

System.InvalidOperationException: Can't parse this object to the database - there are no properties set

the dynamic objects "item" never actually remember their new values.

@erolnicki

solved with pull request tied to "issue # 85"

@erolnicki erolnicki closed this Sep 13, 2011
@chzhcpu
chzhcpu commented Mar 8, 2012

"issue # 85" can not solve the problem "the dynamic objects item never actually remember their new values"
the demo should change like this:
var table = new Products();
//OH NO YOU DIDN't just pass in an integer inline without a parameter!
//I think I might have... yes
var drinks = table.All("WHERE CategoryID = 8").ToArray();
//what we get back here is an IEnumerable < ExpandoObject > - we can go to town
foreach(var item in drinks){
//turn them into Haack Snacks
item.CategoryID = 12;
}
//Let's update these in bulk, in a transaction shall we?
table.Save(drinks);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment