Altering a module that has data access

Topics: General, Writing modules
May 1, 2012 at 1:42 AM

Hi all,

I'm trying to add a new field to the image gallery module (mello) and it's all fine except I can't seem to get it to write the value back to the database.

It's just a field called Link and is a string. I'll post the code if necessary but I think I must be missing something simple.

I've read over the Understanding data access document and even put an UpdateFrom3 method in the migration.cs file however the 'Some features need to be upgraded' notification doesn't even appear. Not sure but maybe this is a symptom of my problem.



May 1, 2012 at 1:46 AM

You mean a property?

Since 1.4, migrations run silently and automatically, so it's normal that you wouldn't get a notification. Check the DB directly to see if it changed.

May 1, 2012 at 2:01 AM

Hi Bertrand,

Yep, a property.

It has created the field in the database, awesome. I see there's an Edit this page on the documentation. Can I update it or do I need access?

Any ideas why the Repository update (and create) are not updating the db field?



May 1, 2012 at 3:37 AM

You can edit. That will make a pull request, and when that gets accepted, the site gets updated.

If you wired your repository correctly in your handler, any change to a part would get persisted automatically, unless there is an exception rolling back the transaction. So either you didn't wire the repo correctly, or there is an exception preventing the persistence from happening. Look for it in your app_data\logs.

May 1, 2012 at 10:02 PM

There's nothing related in the logs.

Ok, something strange going on here. I deployed the site to the test server and the data persistence is working correctly there, just not in my localhost. It's neither reading or writing to the database locally (shared database, connectionstring details). Is it possible that there's something loaded in memory somewhere that could be ignoring the change locally? I've cleaned, rebuild, application restart (by altering global.asax), even deleted the Mello.ImageGallery.dll from the bin folder. When I debug locally I hit the breakpoints and can see the property being populated correctly so the symbols are loading.

May 1, 2012 at 10:28 PM

Anything in app_data\logs?

May 1, 2012 at 10:39 PM

Nothing in the logs. The debug & error logs for today are empty

May 1, 2012 at 11:15 PM

Just for that module? Others persist fine? Did you try to contact the author of the module?

May 1, 2012 at 11:24 PM

Just for the newly added property on that module. All other properties persist fine locally.

I'll put a discussion up on to point Gabriel at this discussion. It seems to me like it's more likely to be some anomaly with one of the frameworks though.

Thanks Bertrand.


May 1, 2012 at 11:27 PM

Aaaaaah. Well, yes, delete mappings.bin in app_data and let's see if that makes a difference.

May 1, 2012 at 11:49 PM


Deleted Orchard\src\Orchard.Web\App_Data\Sites\Default\mappings.bin, stopped the web dev server and restarted debugging and it works now.

Thanks again for your help.