1

Closed

Bugs in PrimaryKeyName and UpdateOriginalFromChanged

description

I've just tried updating a project to use version 2.0, and come across a couple of major problems with some of my existing code that uses the GetEntity and UpdateOriginalFromChanged.
 
In order to make the minimum of changes I have replaced the previous inheritance from GenericController with inheritance from StaticGenericRepository, however when I'm calling GetEntity, this is throwing a null reference exception. This looks to be being caused by the Get method for the PrimaryKeyName property which is returning primaryKey.MappedName at line 156 which is then used to try and find the primary key property - using primaryKey.Name instead allows this to work.
 
There is a similar problem in UpdateOriginalFromChanged, where the DatabaseProperties method is again using dm.MappedName at line 199.
 
Both of these bugs would only be apparent when using DBML that renames some of the columns - MappedName is the name of the underlying database field, which in our case is different from the property names in the LINQ data model.
Closed Sep 30, 2009 at 10:30 AM by taliesins

comments

taliesins wrote Sep 30, 2009 at 9:55 AM

Yes you are totally correct. Thanks for catching this bug. It will be updated in future versions

wrote Sep 30, 2009 at 10:30 AM

wrote Feb 14, 2013 at 12:42 AM

wrote May 16, 2013 at 5:28 AM