我创建了一个新的Movie ContentType,其中附加了Taxonomy Field(使用迁移)。使用IEventHandler
Enabled
事件创建分类标准名称和术语。
我登录仪表板,我可以看到使用所有术语创建的分类法字段。
现在,我尝试创建一个新的Movie
ContentItem,我得到以下异常。
请问好吗?
2014-02-27 13:44:38,996 [24] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
NHibernate.Exceptions.GenericADOException: could not insert: [Orchard.ContentManagement.Records.ContentItemRecord][SQL: INSERT INTO Orchard_Framework_ContentItemRecord (Data, ContentType_id) VALUES (?, ?)] ---> System.Data.SqlServerCe.SqlCeLockTimeoutException: SQL Server Compact timed out waiting for a lock. The default lock time is 2000ms for devices and 5000ms for desktops. The default lock timeout can be increased in the connection string using the ssce: default lock timeout property. [ Session id = 2,Thread id = 9324,Process id = 4488,Table name = Orchard_Framework_ContentItemRecord,Conflict type = x lock (x blocks),Resource = PAG (idx): 1066 ]
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:line 203
at NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Id\Insert\AbstractSelectingDelegate.cs:line 38
--- End of inner exception stack trace ---
at NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Id\Insert\AbstractSelectingDelegate.cs:line 47
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 2575
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Object obj, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 3035
at NHibernate.Action.EntityIdentityInsertAction.Execute() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Action\EntityIdentityInsertAction.cs:line 75
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Engine\ActionQueue.cs:line 136
at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\AbstractSaveEventListener.cs:line 259
at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\AbstractSaveEventListener.cs:line 187
at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\AbstractSaveEventListener.cs:line 119
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveOrUpdateEventListener.cs:line 162
at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveEventListener.cs:line 27
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveOrUpdateEventListener.cs:line 148
at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveEventListener.cs:line 21
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveOrUpdateEventListener.cs:line 53
at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 2673
at NHibernate.Impl.SessionImpl.Save(Object obj) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 485
at Orchard.Data.Repository`1.Create(T entity) in c:\Dev\Repos\orchardfeb\src\Orchard\Data\Repository.cs:line 96
at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Create(T entity) in c:\Dev\Repos\orchardfeb\src\Orchard\Data\Repository.cs:line 36
at Orchard.ContentManagement.DefaultContentManager.Create(ContentItem contentItem, VersionOptions options) in c:\Dev\Repos\orchardfeb\src\Orchard\ContentManagement\DefaultContentManager.cs:line 511
at Orchard.Core.Contents.Controllers.AdminController.CreatePOST(String id, String returnUrl, Action`1 conditionallyPublish) in c:\Dev\Repos\orchardfeb\src\Orchard.Web\Core\Contents\Controllers\AdminController.cs:line 233
at Orchard.Core.Contents.Controllers.AdminController.CreateAndPublishPOST(String id, String returnUrl) in c:\Dev\Repos\orchardfeb\src\Orchard.Web\Core\Contents\Controllers\AdminController.cs:line 224
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
2014-02-27 13:44:39,054 [24] NHibernate.AssertionFailure - An AssertionFailure occurred - this may indicate a bug in NHibernate or in your custom types.
NHibernate.AssertionFailure: null id in Orchard.ContentManagement.Records.ContentItemRecord entry (don't flush the Session after an exception occurs)
答案 0 :(得分:1)
正如写here,这意味着发生了一些错误,NHibernate无法保存记录并为其创建id,但半持久保存记录并尝试再次保存...没有{{1 }}。基础错误各不相同,可能是由于你的情况下缺少表,列名中的拼写错误,模型和迁移之间的任何不一致(在Orchard或类似的框架中 - 我有一些可空/不可错的不匹配)使用保留字,a独特的约束......没有防弹解决方案,你必须找到(调试软件是必须的并记录你的朋友)并解决原因。