我有一个非常复杂的SP,它返回基类(basecontent)。我有大约30多个子课程(如“页面”,“新闻”等)的继承权。
当我从SP返回其他类型时,一切正常,但是这个让我发疯。我对LINQ很有经验,已经尝试过重新创建SP,验证outout等。 但是,即使返回的行数为零,此调用也无法进行Stackoverflow异常。
我有解决方法 - 当我加入另一个表时,它有一些关于内容的统计信息并且没有任何继承,而不是我能够使用C#转到内容表并获取数据,但这会显着降低性能我
到目前为止,我的主要猜测是我的继承映射有问题。这是这个类的xml:
<Table Name="dbo.baseContent" Member="baseContents">
<Type Name="baseContent" Id="ID50" InheritanceCode="1" IsInheritanceDefault="true">
<Column Name="Id" Type="System.Int64" DbType="BigInt NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="Type" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" IsDiscriminator="true" />
<Column Name="Status" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
<Column Name="UniqueId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
<Column Name="LastChanged" Member="LastChangedUTC" Storage="_LastChanged" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" UpdateCheck="Never" />
<Column Name="Title" Modifier="Virtual" Type="System.String" DbType="NVarChar(255) NOT NULL" CanBeNull="false" />
<Column Name="Version" Type="System.Int64" DbType="Bigint" CanBeNull="true" UpdateCheck="Never" />
<Column Name="Tags" Type="System.String" DbType="NVarchar(255)" CanBeNull="false" />
<Column Name="baseOwnerId" Type="System.Int64" DbType="BigInt NOT NULL" CanBeNull="true" />
<Column Name="Views" Type="System.Int32" DbType="int" CanBeNull="false" />
<Column Name="VotesValue" Type="System.Int32" DbType="int" CanBeNull="true" />
<Column Name="Clicks" Type="System.Int32" DbType="int" CanBeNull="true" UpdateCheck="Never" />
<Column Name="IsHidden" Type="System.Boolean" DbType="bit" CanBeNull="false" />
<Column Name="IsFeatured" Type="System.Boolean" DbType="bit" CanBeNull="false" />
<Column Name="IsAdvertising" Type="System.Boolean" DbType="bit" CanBeNull="false" />
<Column Name="LoyaltyPoints" Type="System.Int32" DbType="int" CanBeNull="true" />
<Column Name="CreatedDate" Type="System.DateTime" DbType="datetime" CanBeNull="true" />
<Column Name="ViewsDetails" Type="System.Int32" DbType="int" CanBeNull="true" UpdateCheck="Never" />
<Association Name="baseContent_baseDictionary" Member="baseDictionary" Storage="_baseDictionaries" ThisKey="Id" OtherKey="ContentId" Type="baseDictionary" Cardinality="One" />
<Association Name="baseContent_tTopic" Member="tTopic" ThisKey="Id" OtherKey="ContentId" Type="tTopic" Cardinality="One" />
<Association Name="baseContent_baseFile" Member="baseFile" Storage="_baseFiles" ThisKey="Id" OtherKey="ContentId" Type="baseFile" Cardinality="One" />
<Association Name="baseContent_tLink" Member="tLink" ThisKey="Id" OtherKey="ContentId" Type="tLink" Cardinality="One" />
<Association Name="baseContent_tNews" Member="tNews" ThisKey="Id" OtherKey="ContentId" Type="tNews" Cardinality="One" />
<Association Name="baseContent_tModule" Member="tModule" ThisKey="Id" OtherKey="ContentId" Type="tModule" Cardinality="One" />
<Association Name="baseContent_tPage" Member="tPage" ThisKey="Id" OtherKey="ContentId" Type="tPage" Cardinality="One" />
<Association Name="baseContent_tOwner" Member="tOwner" Storage="_tOwners" ThisKey="Id" OtherKey="ContentId" Type="tOwner" Cardinality="One" />
<Association Name="baseContent_tMessage" Member="tMessage" ThisKey="Id" OtherKey="ContentId" Type="tMessage" Cardinality="One" />
<Association Name="baseContent_tTheme" Member="tTheme" Storage="_tTemplates" ThisKey="Id" OtherKey="ContentId" Type="tTheme" Cardinality="One" />
<Association Name="baseContent_Tags_baseContent" Member="Tags_baseContents" ThisKey="Id" OtherKey="ContentId" Type="Tags_baseContent" />
<Association Name="baseContent_tGoodie" Member="tGoodie" ThisKey="Id" OtherKey="ContentId" Type="tGoodie" Cardinality="One" />
<Association Name="baseContent_tModuleSkin" Member="tModuleSkin" ThisKey="Id" OtherKey="ContentId" Type="tModuleSkin" Cardinality="One" />
<Association Name="baseContent_tLocation" Member="tLocation" ThisKey="Id" OtherKey="ContentId" Type="tLocation" Cardinality="One" />
<Association Name="baseContent_tEvent" Member="tEvent" ThisKey="Id" OtherKey="ContentId" Type="tEvent" Cardinality="One" />
<Association Name="baseContent_tThread" Member="tThread" ThisKey="Id" OtherKey="ContentId" Type="tThread" Cardinality="One" />
<Association Name="baseContent_tThread1" Member="RelatedThreads" Storage="_RelatedThread" ThisKey="Id" OtherKey="RelatedContentId" Type="tThread" />
<Association Name="baseContent_ContentVisit" Member="ContentVisit" Storage="_ContentVisits" ThisKey="Id" OtherKey="ContentId" Type="ContentVisit" Cardinality="One" />
<Association Name="baseContent_tThreadAnswer" Member="tThreadAnswer" ThisKey="Id" OtherKey="ContentId" Type="tThreadAnswer" Cardinality="One" />
<Type Name="baseRole" Id="ID51" InheritanceCode="2" />
<Type Name="baseFolder" Id="ID52" InheritanceCode="3" />
<Type Name="TopicContent" Id="ID53" InheritanceCode="5" />
<Type Name="TopicPageContent" Id="ID54" InheritanceCode="6" />
<Type Name="baseDictionaryContent" Id="ID55" InheritanceCode="7" />
<Type Name="FileContent" Id="ID56" InheritanceCode="8" />
<Type Name="TopicPlaceholderContent" Id="ID57" InheritanceCode="9" />
<Type Name="TopicModuleContent" Id="ID58" InheritanceCode="10" />
<Type Name="TopicLinkContent" Id="ID59" InheritanceCode="11" />
<Type Name="TopicPageLayoutContent" Id="ID60" InheritanceCode="12" />
<Type Name="TopicThemeContent" Id="ID61" InheritanceCode="13" />
<Type Name="TopicNewsContent" Id="ID62" InheritanceCode="14" />
<Type Name="TopicMessageContent" Id="ID63" InheritanceCode="15" />
<Type Name="TopicOfferContent" Id="ID64" InheritanceCode="16" />
<Type Name="TopicVoteUpContent" Id="ID65" InheritanceCode="17" />
<Type Name="TopicVoteDownContent" Id="ID66" InheritanceCode="18" />
<Type Name="TopicOwnerContent" Id="ID67" InheritanceCode="19" />
<Type Name="TopicModuleTypeContent" Id="ID68" InheritanceCode="20" />
<Type Name="TopicContainerTypeContent" Id="ID69" InheritanceCode="21" />
<Type Name="TopicLanguageContent" Id="ID70" InheritanceCode="22" />
<Type Name="TopicGoodieContent" Id="ID71" InheritanceCode="23" />
<Type Name="TopicModuleSkinContent" Id="ID72" InheritanceCode="24" />
<Type Name="TopicEventContent" Id="ID73" InheritanceCode="25" />
<Type Name="TopicLocationContent" Id="ID74" InheritanceCode="26" />
<Type Name="AbstractContentItem" Id="ID75" InheritanceCode="10000" />
<Type Name="TopicThreadContent" Id="ID76" InheritanceCode="27" />
<Type Name="TopicThreadAnswerContent" Id="ID77" InheritanceCode="28" />
<Type Name="NavigationInfoContent" Id="ID78" InheritanceCode="29" />
<Type Name="TopicViewContent" Id="ID79" InheritanceCode="30" />
<Type Name="VisitedContent" Id="ID80" InheritanceCode="31" />
</Type>
</Table>
这是SP的声明:
<Function Name="dbo.SearchAdvanced" Method="SearchAdvanced">
<Parameter Name="searchTerm" Type="System.String" DbType="NVarChar(4000)" />
<Parameter Name="searchKeywords" Type="System.String" DbType="NVarChar(4000)" />
<Parameter Name="searchType" Type="System.Int64" DbType="BigInt" />
<Parameter Name="searchTreeType" Type="System.Int64" DbType="BigInt" />
<Parameter Name="parentList" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="filterList" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="filterValue" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="filterLessList" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="filterLessValue" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="filterGreaterList" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="filterGreaterValue" Type="System.String" DbType="VarChar(MAX)" />
<Parameter Name="LCID" Parameter="lCID" Type="System.Int32" DbType="Int" />
<Parameter Name="minLevels" Type="System.Int32" DbType="Int" />
<Parameter Name="Levels" Parameter="levels" Type="System.Int32" DbType="Int" />
<Parameter Name="pageSize" Type="System.Int32" DbType="Int" />
<Parameter Name="PageNumber" Parameter="pageNumber" Type="System.Int32" DbType="Int" />
<Parameter Name="sortOrder" Type="System.Int32" DbType="Int" />
<Parameter Name="TopicContentId" Parameter="topicContentId" Type="System.Int64" DbType="BigInt" />
<Parameter Name="totalRows" Type="System.Int32" DbType="Int" Direction="InOut" />
<ElementType IdRef="ID50" />
</Function>
答案 0 :(得分:0)
是否可以使用VS2010 beta进行重新测试? IIRC中存在一个错误,其中一个IQueryable<T>
实现基本类已在4.0中修复。您可能会发现它适用于4.0,然后问题变为:等到4月?
答案 1 :(得分:0)
只需使用标准的故障查找技术 - 减半并检查
将SP编辑为只有前半部分的参数,将映射调整为相同。没问题 - 尝试另一半。仍然有问题,再次减半,你会发现导致它的原因