Incorrect UPDATE SQL being generated by DataContext

When using the DataContext object to retrieve and update a database, if I have a property that maps to a column with a different name the UPDATE SQL generated uses the property name as opposed to the name specified in the column attribute.

[Table(Name="TestTable")]
public class TestObject
{
private string _description=string.Empty;

[Column(Name="TestDescription", Storage="_description")]
public string Description
{
get
{
return _description;
}
set
{
_description=value;
}
}
}

DataContext context=new DataContext(connection);
Table<TestObject> table=context.GetTable<TestObject>();

TestObject obj=Sequence.First<TestObject>(table);
obj.Description="Description Changed";

context.SubmitChanges(); // Get error here - update statement has UPDATE TestTable SET Description= ...

// Should be UPDATE TestTable SET TestDescription = ...

[951 byte] By [JamesLett] at [2008-3-7]
# 1
Thanks James. I've got that fixed now. That's what I get for using a set of auto generated classes (where the column and field names match) for my tests! Please, anyone else finding obvious bugs let us know here on the forums. We are planning a refresh of the preview after Whidbey RTM is available.
MattWarren at 2007-9-9 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...

Visual Studio Orcas

Site Classified