首页 新闻 会员 周边

求C#大神指点。重写抽象方法一直提示没有找到合适的方法重写。基类是有该方法的,拼写也没有错,我快吐血了

0
悬赏园豆:20 [已解决问题] 解决于 2015-10-07 16:31
基类:
public abstract class SolrSearcher<Record, Result> : Searcher<Result>
{
protected SolrSearcher();

protected abstract string SolrCoreName { get; }

protected virtual QueryOptions BuildQueryOptions(SearchCondition condition);
protected abstract Result TransformSolrQueryResult(SolrQueryResults<Record> solrQueryResult, SearchCondition condition);
}
实现类方法:
new protected QueryOptions BuildQueryOptions(SearchCondition condition)
{
//此方法硬要说返回值和基类不同,不得已才用了new
}
protected override WeaponrySearchResult TransformSolrQueryResult(SolrQueryResults<Weaponry> solrQueryResult, SearchCondition condition)
{
//省略掉了
}
错误 3 “DefenderKingdom.Service.WeaponrySearcher.BuildQueryOptions(DK.Utility.DataAccess.SearchEngine.SearchCondition)”: 返回类型必须是“SolrNet.Commands.Parameters.QueryOptions”才能与重写成员“DK.Utility.DataAccess.SearchEngine.Solr.SolrSearcher<DefenderKingdom.Entity.Weaponry,DefenderKingdom.Entity.WeaponrySearchResult>.BuildQueryOptions(DK.Utility.DataAccess.SearchEngine.SearchCondition)”匹配 C:\Users\duguk\Desktop\DefenderKingdom\DefenderKingdom.Service\WeaponrySearcher.cs 20 41 DefenderKingdom.Service
错误 4 “DefenderKingdom.Service.WeaponrySearcher.TransformSolrQueryResult(SolrNet.SolrQueryResults<DefenderKingdom.Entity.Weaponry>, DK.Utility.DataAccess.SearchEngine.SearchCondition)”: 没有找到适合的方法来重写 C:\Users\duguk\Desktop\DefenderKingdom\DefenderKingdom.Service\WeaponrySearcher.cs 34 49 DefenderKingdom.Service
我简直醉了
问题补充:

错误 2 “DefenderKingdom.Service.WeaponrySearcher”不实现继承的抽象成员“DK.Utility.DataAccess.SearchEngine.Solr.SolrSearcher.TransformSolrQueryResult(SolrNet.SolrQueryResults`1, DK.Utility.DataAccess.SearchEngine.SearchCondition)”

我已经知道问题出在什么地方,出在SolrNet.SolrQueryResults`1这个‘1上,请问这种情况怎么处理呢

Scott Lewis的主页 Scott Lewis | 初学一级 | 园豆:151
提问于:2015-10-06 19:29
< >
分享
最佳答案
0

亲,编译时都给出提示了,返回类型与基类不符啊。

protected QueryOptions BuildQueryOptions(SearchCondition condition)

改成

protected SolrNet.Commands.Parameters.QueryOptions BuildQueryOptions(SearchCondition condition)

收获园豆:20
I,Robot | 大侠五级 |园豆:9783 | 2015-10-07 09:10

写成这样也不行的

Scott Lewis | 园豆:151 (初学一级) | 2015-10-07 10:28
其他回答(2)
0

抽象方法和虚拟方法都用override重写

稳稳的河 | 园豆:4216 (老鸟四级) | 2015-10-07 09:19
0

终于解决了,其实是dll版本的问题

Scott Lewis | 园豆:151 (初学一级) | 2015-10-07 16:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册