NHibernateContext (ADO.NET Data Services support) bugfix

Description

I'm using NHibernate.Linq to expose data in a REST-ful manner using ADO.NET Data Services (ADS). I discovered that when updating an entity using a HTTP PUT request, the current IUpdatable implementation will reset all of the entity's properties to their default (usually null) values. While this is the desired behavior for primitive properties, it shouldn't be done for entity properties. The default IUpdatable implementation that ADS contains for ADO.NET Entity Framework checks if the property is of an entity type and if so, skips resetting its value. I read that in the docs, but you can decompile System.Data.Services.Providers.ObjectContextServiceProvider.ResetResource for further reference

I have done the same for NHibernateContext that implements IUpdatable. I get the property type from the IClassMetadata object and reset the property only if the property type IsEntityType property is false. I also added two tests that cover the scenarios. I am attaching a patch.

I am using the MySQL ADO.NET provider and .NET 3.5 SP1.

Thanks,
Hristo

Environment

None

Attachments

1

Activity

Chad Lee 
October 29, 2009 at 1:08 PM

Fixed in r1100

Fixed

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created October 5, 2009 at 10:34 AM
Updated October 29, 2009 at 1:08 PM
Resolved October 29, 2009 at 1:08 PM
Who's Looking?