简体   繁体   English

无法将链接添加到回购方法(ASP.NET Core)

[英]Cannot add link to repo method (ASP.NET Core)

I have ASP.NET Core website and .NET Core Class Library for repo methods. 我有ASP.NET Core网站和.NET Core类库作为回购方法。

I added reference to ASP.NET Core in Class Library. 我在类库中添加了对ASP.NET Core的引用。

In Class Library I have repo method 在类库中,我有回购方法

    using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ToSeeWeb.Models;
using ToSeeWeb.Controllers;

namespace ToSeeRepo.Repositories
{
    public class ExperienceRepository
    {
        private readonly ToSeeDBContext _context;

        public List<Experience> GetAllExperience() {
            return _context.Experience.ToList();
        }



    }
}

And in Controller in ASP.NET Core controller I need to adв link to this repo 在ASP.NET Core控制器的Controller中,我需要将链接链接到此仓库

So I trying to do it like this 所以我试图这样做

private ExperienceRepository _exprepo = new ExperienceRepository();

But it don't see it. 但是它看不到。

Also I cannot add using TooSeeRepo.Repositories 我也不能using TooSeeRepo.Repositories添加

How I can solve this problem? 我该如何解决这个问题?

So I found problem solution. 所以我找到了问题的解决方案。

I delete ClassLibrary from Solution and from folder. 我从解决方案和文件夹中删除ClassLibrary。 After that I restarted Visual Studio and added it again and linked with parent project. 之后,我重新启动Visual Studio并再次添加它并与父项目链接。

After those steps, it working great. 完成这些步骤后,效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM