0
votes

I have a new Orchard CMS 1.4.2 installation that I have added a custom module to.

The custom module has 3 custom parts that are basically copies of the bodypart ContentPart.

I don't know much about the bodypart (or Orchard...), and I note that the mycustompartrecord class derives from:

ContentPartVersionRecord

One question is that I don't know why.

The other question is that running the site, I get the following error after updating the text of one of the custom "bodypart" content parts.

2012-06-02 08:15:49,580 [21] Orchard.ContentManagement.DefaultContentManager - ArgumentOutOfRangeException thrown from IContentHandler by Orchard.Autoroute.Handlers.AutoroutePartHandler
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
   at Orchard.Autoroute.Services.AutorouteService.GetDefaultPattern(String contentType)
   at Orchard.Autoroute.Services.AutorouteService.GenerateAlias(AutoroutePart part)
   at Orchard.Autoroute.Handlers.AutoroutePartHandler.PublishAlias(AutoroutePart part)
   at Orchard.Autoroute.Handlers.AutoroutePartHandler.<.ctor>b__2(PublishContentContext ctx, AutoroutePart part)
   at Orchard.ContentManagement.Handlers.ContentHandler.InlineStorageFilter`1.Published(PublishContentContext context, TPart instance) in C:\Users\Andrew\Documents\Dox\Webs\Orchard\src\Orchard\ContentManagement\Handlers\ContentHandler.cs:line 156
   at Orchard.ContentManagement.Handlers.StorageFilterBase`1.Orchard.ContentManagement.Handlers.IContentStorageFilter.Published(PublishContentContext context) in C:\Users\Andrew\Documents\Dox\Webs\Orchard\src\Orchard\ContentManagement\Handlers\StorageFilterBase.cs:line 81
   at Orchard.ContentManagement.Handlers.ContentHandler.Orchard.ContentManagement.Handlers.IContentHandler.Published(PublishContentContext context) in C:\Users\Andrew\Documents\Dox\Webs\Orchard\src\Orchard\ContentManagement\Handlers\ContentHandler.cs:line 274
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass3d.<Publish>b__3b(IContentHandler handler) in C:\Users\Andrew\Documents\Dox\Webs\Orchard\src\Orchard\ContentManagement\DefaultContentManager.cs:line 342
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Users\Andrew\Documents\Dox\Webs\Orchard\src\Orchard\InvokeExtensions.cs:line 19

I really have no idea what is the cause of this. It seems to have no negative effect, on adding content. I suspect it is something to do with the way I am using these bodypart copies, but I am not sure.

NOTE:

As discussed in a previous thread (See details here), I have previously had another error, when using a CLEAN source code installation (ie, no modules, nothing custom) of Orchard v.1.4.2. The error is as follows:

Before installing any modules, and with a clean install, I was getting the following error:

2012-05-31 17:59:43,876 [9] NHibernate.AdoNet.AbstractBatcher - Could not execute query: SELECT this_.Id as Id13_0_, this_.SerialNumber as SerialNu2_13_0_ FROM Settings_ShellDescriptorRecord this_ WHERE 1=1
    System.Data.SqlServerCe.SqlCeException (0x80004005): The specified table does not exist. [ Settings_ShellDescriptorRecord ]
       at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
       at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader(CommandBehavior behavior)
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
    2012-05-31 17:59:43,892 [9] NHibernate.Util.ADOExceptionReporter - The specified table does not exist. [ Settings_ShellDescriptorRecord ]
    2012-05-31 17:59:43,907 [9] NHibernate.Util.ADOExceptionReporter - The specified table does not exist. [ Settings_ShellDescriptorRecord ]

The error has only appeared once in the logs, and doesn't seem to affect the system thereafter. Don't know if this is relevant to the autoroutepart error.

1

1 Answers

1
votes

Unfortunately I can't answer your main question.

As for ContentPartVersionRecord: when you need a part to be versioned (i.e. saving a new copy of its content with every modification), you need to use this. BodyPart is a case of versioned content parts.

The SQL exception you're getting is I think completely harmless, as it's expected on setup. This query is used to check if the DB was already set up or not - if it fails, then not.