第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

嘗試使用 addScoped ASP.Net core 2.1 將 Irepositories

嘗試使用 addScoped ASP.Net core 2.1 將 Irepositories

C#
qq_笑_17 2022-01-15 19:33:41
我正在嘗試將我的 Irepository 接口和 irepository 添加到服務(wù)中,以便我可以使用它們。我這樣做:services.AddScoped<AuctioniRepository, IrepoAuctionInterface>();這是我得到的錯(cuò)誤:錯(cuò)誤 CS0311 類型“NackowskiLillMygel.Data.IrepoAuctionInterface”不能用作泛型類型或方法“ServiceCollectionServiceExtensions.AddScoped(IServiceCollection)”中的類型參數(shù)“TImplementation”。沒有從“NackowskiLillMygel.Data.IrepoAuctionInterface”到“NackowskiLillMygel.Data.AuctioniRepository”的隱式引用轉(zhuǎn)換。NackowskiLillMygel 源\repos\NackowskiLillMygel\NackowskiLillMygel\Startup.cs 39 活動(dòng)我不明白我做錯(cuò)了什么。另外,如果您需要來自存儲(chǔ)庫的更多代碼,請(qǐng)告訴我。我非常感謝您的回答!
查看完整描述

2 回答

?
滄海一幻覺

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超5個(gè)贊


您正在將接口注冊(cè)為IrepoAuctionInterface. .AddScoped() 方法的簽名如下:


public static IServiceCollection AddScoped<TService, TImplementation>(this IServiceCollection services)

    where TService : class

    where TImplementation : class, TService;

這意味著TService應(yīng)該實(shí)現(xiàn)TImplementation,而您則以相反的方式進(jìn)行。


你應(yīng)該像這樣翻轉(zhuǎn)參數(shù):


services.AddScoped<IrepoAuctionInterface, AuctioniRepository>();


查看完整回答
反對(duì) 回復(fù) 2022-01-15
?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊

只需IrepoAuctionInterface在類中實(shí)現(xiàn)接口AuctioniRepository

喜歡

public class AuctioniRepository : IrepoAuctionInterface
{
}


查看完整回答
反對(duì) 回復(fù) 2022-01-15
  • 2 回答
  • 0 關(guān)注
  • 187 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)