This project is read-only.

Infoset Version (Fields versioning)

Topics: Troubleshooting
Apr 1, 2011 at 9:57 AM

I think field versioning isn't implimented yet..

I've implimented versioning for parts.. now the record versions works perfect with each new version of the contentitem.
Except for fields.. they end in the table Orchard_Framework_ContentItemRecord Data column by the SimpleFieldStorage.

I looked at the classes implimenting IFieldStorageProvider and the only one i encounter is InfosetStorageProvider, in which BindStorage just uses the infosetPart.Infoset and not the infosetPart.VersionInfoset

I see that Orchard_Framework_ContentItemVersionRecord has a Data column as well and the VersionInfoset is assigned to the record in the InfosetHandler.

I'm just missing an InfosetVersionStorageProvider

What would you guys recommend?

- is it implimented in 1.1 ? (i'm still on 1.0)
- fire a bug and contribute myself in orchard
- something else

Apr 1, 2011 at 10:46 AM

ok the something else part:

why is there even a Data column in the table ContentItemRecord ?
Wouldn't it be better to only have a Data column in the table ContentItemVersionRecord as there is always at least 1 version (even if it isn't versionable) ?

I adjusted the InfosetStorageProvider to use the versionrecord data.

        public IFieldStorage BindStorage(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition) {
            var partName = XmlConvert.EncodeLocalName(contentPart.PartDefinition.Name);
            var fieldName = XmlConvert.EncodeLocalName(partFieldDefinition.Name);
            var infosetPart = contentPart.As<InfosetPart>();

            return new SimpleFieldStorage(
                name => Get(infosetPart.VersionInfoset.Element, partName, fieldName, name),
                (name, value) => Set(infosetPart.VersionInfoset.Element, partName, fieldName, name, value));

This means that the Infoset data column can be deprecated...
There should be a migration: update Orchard_Framework_ContentItemVersionRecord set Data = select Data from Orchard_Framework_ContentItemRecord where ....
ok no sql possible in the migration classes that easy... might as well reference NHibernate directly for executing sql statements.


Apr 1, 2011 at 8:21 PM

Sure, please file a bug. It won't go into 1.1, though: too late for that.

Apr 1, 2011 at 8:23 PM

What about the suggestion about the Data column?
I believe the Data column should be dropped from the ContentItemRecord.

Apr 1, 2011 at 8:29 PM
Edited Apr 1, 2011 at 8:30 PM

File a bug :) (in other words, I don't know, I'd need to look at it in details, ask the devs, etc. Filing a bug ensures this happens)

Apr 1, 2011 at 8:29 PM
bertrandleroy wrote:

File a bug :)

Done :)

Feb 14, 2012 at 8:07 AM

Each version i've to reintroduce this change, the workitem hasn't been fixed nor looked into?

Feb 14, 2012 at 8:55 AM

Go for it.

Feb 14, 2012 at 5:35 PM

Was fixed in 1.x source code. Can you confirm you are using 1.3 ?