小编Sta*_*ord的帖子

如何让dotnet core选择较低版本?

我的系统中有多个版本的 dotnet core。但.Net Core项目选择最新版本来构建项目。我可以做些什么来确保项目选择正确的版本?我正在使用 Visual Studio 进行开发。

.net visual-studio asp.net-core

16
推荐指数
4
解决办法
3万
查看次数

无法将类型“IEnumerable<T>”隐式转换为“ActionResult<IEnumerable<T>>”

我正在尝试从数据库中获取条目列表。但我收到错误。

无法将类型“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)

.net c# ienumerable .net-core webapi

5
推荐指数
1
解决办法
3621
查看次数

Xamarin 中的 [assembly: Dependency()] 是什么?

我是 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)

.net c# android xamarin xamarin.forms

4
推荐指数
1
解决办法
811
查看次数

有没有办法延长已经过期的 Azure sas 令牌的有效期?

在我正在工作的项目中,SAS令牌用于下载Azure Blob存储中的文件。其中一些令牌已经过期。我想知道是否有什么方法可以延长过期的令牌以便再次使用。

asp.net azure

2
推荐指数
1
解决办法
6378
查看次数