0

我该如何纠正以下错误?由于出现错误,无法运行 SpecFlow 测试。

  NHibernate.AdoNet.AbstractBatcher Error: 0 : Could not execute command: INSERT INTO ..._TaxonomyCatalogPartRecord (General, Reproduction, Identification, Culture, Evolution, Morphology, Id) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6)
  NHibernate.Util.ADOExceptionReporter Error: 0 : The column name is not valid. [ Node name (if any) = ,Column name = Evolution ]
  Orchard.ContentManagement.DefaultContentManager Error: 0 : GenericADOException thrown from IContentHandler by Orchard.Autoroute.Handlers.AutoroutePartHandler
  NHibernate.AssertionFailure Error: 0 : An AssertionFailure occurred - this may indicate a bug in NHibernate or in your custom types.
  NHibernate.Impl.AbstractSessionImpl Error: 0 : DTC transaction prepre phase failed

这两列不是为我的模块的 TaxonomyCatalogPartRecord 创建的。我的模块的迁移似乎没有正确运行。

迁移有以下方法:

  1. “创建()”返回 5
  2. “UpdateFrom5()”返回 8
  3. “UpdateFrom8()”返回 9
  4. “UpdateFrom9()”返回 10

该表在 Create() 中创建:

SchemaBuilder.CreateTable(
                "TaxonomyCatalogPartRecord",
                table =>
                table
                    .ContentPartRecord()
                    .Column<string>("General", c => c.Unlimited())
                    .Column<string>("Reproduction", c => c.Unlimited())
                    .Column<string>("Identification", c => c.Unlimited())
                    .Column<string>("Culture", c => c.Unlimited())
                );

在 UpdateFrom9() 中添加了这两列,代码如下:

SchemaBuilder.AlterTable("TaxonomyCatalogPartRecord", t => {
                t.AddColumn<string>("Evolution");
                t.AddColumn<string>("Morphology");
            });

SpecFlow 运行期间还出现以下错误:

  NHibernate.AdoNet.AbstractBatcher Error: 0 : Could not execute query: SELECT this_.Id as Id11_0_, this_.SerialNumber as SerialNu2_11_0_ FROM Settings_ShellDescriptorRecord this_ WHERE 1=1
  NHibernate.Util.ADOExceptionReporter Error: 0 : The specified table does not exist. [ Settings_ShellDescriptorRecord ]
  NHibernate.Util.ADOExceptionReporter Error: 0 : The specified table does not exist. [ Settings_ShellDescriptorRecord ]

以及以下内容:

 NHibernate.AdoNet.AbstractBatcher Error: 0 : Could not execute query: 

  SELECT this_.Id as Id338_6_, this_.Number as Number338_6_, this_.Published as Published338_6_, this_.Latest as Latest338_6_, this_.Data as Data338_6_, this_.ContentItemRecord_id as ContentI6_338_6_, autoroutep4_.Id as Id269_0_, autoroutep4_.UseCustomPattern as UseCusto2_269_0_, autoroutep4_.CustomPattern as CustomPa3_269_0_, autoroutep4_.DisplayAlias as DisplayA4_269_0_, autoroutep4_.ContentItemRecord_id as ContentI5_269_0_, titlepartr5_.Id as Id270_1_, titlepartr5_.Title as Title270_1_, titlepartr5_.ContentItemRecord_id as ContentI3_270_1_, contentite1_.Id as Id337_2_, contentite1_.Data as Data337_2_, contentite1_.ContentType_id as ContentT3_337_2_, termpartre2_.Id as Id273_3_, termpartre2_.TaxonomyId as TaxonomyId273_3_, termpartre2_.Path as Path273_3_, termpartre2_.Count as Count273_3_, termpartre2_.Selectable as Selectable273_3_, termpartre2_.Weight as Weight273_3_, commonpart8_.Id as Id294_4_, commonpart8_.OwnerId as OwnerId294_4_, commonpart8_.CreatedUtc as CreatedUtc294_4_, commonpart8_.PublishedUtc as Publishe4_294_4_, commonpart8_.ModifiedUtc as Modified5_294_4_, commonpart8_.Container_id as Container6_294_4_, contenttyp9_.Id as Id339_5_, contenttyp9_.Name as Name339_5_ 

  FROM Orchard_Framework_ContentItemVersionRecord this_ left outer join Orchard_Autoroute_AutoroutePartRecord autoroutep4_ on this_.Id=autoroutep4_.Id left outer join Title_TitlePartRecord titlepartr5_ on this_.Id=titlepartr5_.Id inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Contrib_Taxonomies_TermPartRecord termpartre2_ on contentite1_.Id=termpartre2_.Id left outer join Common_CommonPartRecord commonpart8_ on contentite1_.Id=commonpart8_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp9_ on contentite1_.ContentType_id=contenttyp9_.Id WHERE this_.Published = @p0

  NHibernate.Util.ADOExceptionReporter Error: 0 : The specified table does not exist. [ Contrib_Taxonomies_TermPartRecord ]
  NHibernate.Util.ADOExceptionReporter Error: 0 : The specified table does not exist. [ Contrib_Taxonomies_TermPartRecord ]
  Orchard.Exceptions.DefaultExceptionPolicy Error: 0 : An unexpected exception was caught
  NHibernate.AdoNet.AbstractBatcher Error: 0 : Could not execute query: SELECT this_.Id as Id338_6_, this_.Number as Number338_6_, this_.Published as Published338_6_, this_.Latest as Latest338_6_, this_.Data as Data338_6_, this_.ContentItemRecord_id as ContentI6_338_6_, autoroutep4_.Id as Id269_0_, autoroutep4_.UseCustomPattern as UseCusto2_269_0_, autoroutep4_.CustomPattern as CustomPa3_269_0_, autoroutep4_.DisplayAlias as DisplayA4_269_0_, autoroutep4_.ContentItemRecord_id as ContentI5_269_0_, titlepartr5_.Id as Id270_1_, titlepartr5_.Title as Title270_1_, titlepartr5_.ContentItemRecord_id as ContentI3_270_1_, contentite1_.Id as Id337_2_, contentite1_.Data as Data337_2_, contentite1_.ContentType_id as ContentT3_337_2_, taxonomypa2_.Id as Id272_3_, taxonomypa2_.TermTypeName as TermType2_272_3_, commonpart8_.Id as Id294_4_, commonpart8_.OwnerId as OwnerId294_4_, commonpart8_.CreatedUtc as CreatedUtc294_4_, commonpart8_.PublishedUtc as Publishe4_294_4_, commonpart8_.ModifiedUtc as Modified5_294_4_, commonpart8_.Container_id as Container6_294_4_, contenttyp9_.Id as Id339_5_, contenttyp9_.Name as Name339_5_ FROM Orchard_Framework_ContentItemVersionRecord this_ left outer join Orchard_Autoroute_AutoroutePartRecord autoroutep4_ on this_.Id=autoroutep4_.Id left outer join Title_TitlePartRecord titlepartr5_ on this_.Id=titlepartr5_.Id inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Contrib_Taxonomies_TaxonomyPartRecord taxonomypa2_ on contentite1_.Id=taxonomypa2_.Id left outer join Common_CommonPartRecord commonpart8_ on contentite1_.Id=commonpart8_.Id left outer join Orchard_Framework_ContentTypeRecord contenttyp9_ on contentite1_.ContentType_id=contenttyp9_.Id WHERE this_.Published = @p0
  NHibernate.Util.ADOExceptionReporter Error: 0 : The specified table does not exist. [ Contrib_Taxonomies_TaxonomyPartRecord ]
  NHibernate.Util.ADOExceptionReporter Error: 0 : The specified table does not exist. [ Contrib_Taxonomies_TaxonomyPartRecord ]
  Orchard.Exceptions.DefaultExceptionPolicy Error: 0 : An unexpected exception was caught
4

1 回答 1

0

将 AlterTable 方法更改为 AlterTable 方法的两个单独调用,如下所示:

   SchemaBuilder.AlterTable("TaxonomyCatalogPartRecord", t => t.AddColumn<string>("Evolution")); 
   SchemaBuilder.AlterTable("TaxonomyCatalogPartRecord", t => t.AddColumn<string>("Morphology"));

或者您的语法可能是错误的,应该是

SchemaBuilder.AlterTable("TaxonomyCatalogPartRecord", t => {
                t.AddColumn<string>("Evolution"),
                t.AddColumn<string>("Morphology")
            });

但我不确定那个。祝你好运

于 2012-09-01T15:03:18.447 回答