我的系统中有多个版本的 dotnet core。但.Net Core项目选择最新版本来构建项目。我可以做些什么来确保项目选择正确的版本?我正在使用 Visual Studio 进行开发。
我正在尝试从数据库中获取条目列表。但我收到错误。
无法将类型“System.Collections.Generic.IEnumerable<models.DbModels.GrantProgram>”隐式转换为“Microsoft.AspNetCore.Mvc.ActionResult<System.Collections.Generic.IEnumerable<models.DbModels.GrantProgram>>”[API]
请帮我。我该如何解决这个问题?
控制器.cs
public async Task<ActionResult<IEnumerable<GrantProgram>>> GetGrants()
{
//This is where the error is showing.
return await _grants.GetGrants();
}
Run Code Online (Sandbox Code Playgroud)
业务层
IGrants.cs
Task<IEnumerable<GrantProgram>> GetGrants();
Run Code Online (Sandbox Code Playgroud)
赠款.cs
public async Task<IEnumerable<GrantProgram>> GetGrants()
{
return await _grantRepository.GetGrants();
}
Run Code Online (Sandbox Code Playgroud)
数据访问层
IGrantsRepository.cs
Task<IEnumerable<GrantProgram>> GetGrants();
Run Code Online (Sandbox Code Playgroud)
GrantsRepository.cs
public async Task<IEnumerable<GrantProgram>> GetGrants()
{
return await _context.GrantProgram.ToListAsync();
}
Run Code Online (Sandbox Code Playgroud) 我是 Xamarin 的新手。我正在学习一个教程,在那
[assembly: Dependency(typeof())]
Run Code Online (Sandbox Code Playgroud)
被使用。没看懂这行代码的作用是什么。请解释它的功能。
以下是代码。
[assembly: Dependency(typeof(SQLiteAndroid))]
namespace XamTestThree.Droid.Data {
public class SQLiteAndroid :ISQLite{
public SQLiteAndroid() { }
public SQLite.SQLiteConnection GetConnection()
{
var sqlLiteFileName = "TestDB.db3";
string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var path = Path.Combine(documentPath, sqlLiteFileName);
var conn = new SQLite.SQLiteConnection(path);
return conn;
}
}
}
Run Code Online (Sandbox Code Playgroud) 在我正在工作的项目中,SAS令牌用于下载Azure Blob存储中的文件。其中一些令牌已经过期。我想知道是否有什么方法可以延长过期的令牌以便再次使用。
.net ×3
c# ×2
.net-core ×1
android ×1
asp.net ×1
asp.net-core ×1
azure ×1
ienumerable ×1
webapi ×1
xamarin ×1