plmce2005 / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

SqlMapperExtensions.Update includes computed properties, too #182

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a test class and the corresponding table.
2. Create a new property (not in the table) and decorate it with 
[ComputedAttribute].
3. Create and Update an instance of the test class.

What is the expected output? The corresponding database row should be updated.
 What do you see instead? An error message saying that the property created in step 2, cannot be updated.

What version of the product are you using? - latest one from May 2014.
On what operating system? Windows 7.

Please provide any additional information below.
Please fix the line 243 of SqlMapperExtensions.cs:
from
var nonIdProps = allProperties.Where(a => !keyProperties.Contains(a));
to
var computedProperties = ComputedPropertiesCache(type);
var nonIdProps = allProperties.Except(keyProperties.Union(computedProperties));

Original issue reported on code.google.com by varba...@baxenergy.com on 18 Jul 2014 at 4:25