1

我有一个服务方法Import(),它创建一个新的内容项并发布它。如果我从我的 Controller/Action 或任何 Handler 调用此方法,它工作正常。但是,如果我尝试为此方法创建作业队列,则会创建作业并Import()调用该方法,但在contentManager.Publish(item)class 上失败并出现以下异常DefaultContentManager.cs

An exception of type 'NHibernate.Exceptions.GenericADOException' occurred in NHibernate.dll but was not handled in user code

Additional information: could not execute query

[ SELECT this_.Id as Id1_2_, this_.Number as Number1_2_, this_.Published as Published1_2_, this_.Latest as Latest1_2_, this_.Data as Data1_2_, this_.ContentItemRecord_id as ContentI6_1_2_, contentite1_.Id as Id0_0_, contentite1_.Data as Data0_0_, contentite1_.ContentType_id as ContentT3_0_0_, contenttyp4_.Id as Id2_1_, contenttyp4_.Name as Name2_1_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp4_ on contentite1_.ContentType_id=contenttyp4_.Id WHERE contentite1_.Id = @p0 and this_.Published = @p1 ]

  Name:cp0 - Value:1  Name:cp1 - Value:True

[SQL: SELECT this_.Id as Id1_2_, this_.Number as Number1_2_, this_.Published as Published1_2_, this_.Latest as Latest1_2_, this_.Data as Data1_2_, this_.ContentItemRecord_id as ContentI6_1_2_, contentite1_.Id as Id0_0_, contentite1_.Data as Data0_0_, contentite1_.ContentType_id as ContentT3_0_0_, contenttyp4_.Id as Id2_1_, contenttyp4_.Name as Name2_1_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp4_ on contentite1_.ContentType_id=contenttyp4_.Id WHERE contentite1_.Id = @p0 and this_.Published = @p1]

我的Import()方法如下所示:

public void Import(string id)
{
       ...
     var item = contentManager.New("MyType");
         contentManager.Create(item, VersionOptions.Draft);
       ...
        contentManager.Publish(item);
}

此异常发生在以下语句中:

return contentItemVersionCriteria.List<ContentItemVersionRecord>()
4

0 回答 0