c# - Asp.net:命名空间“DataManager”中不存在类型或命名空间名称“Entity”(您是否缺少程序集引用?)
问题描述
我在 API 项目中添加了一个类库以从数据库中获取数据。在类库“DataManager”中,我创建了一个名为“Entity”的文件夹,并为 sql 和 oracle db 添加了 ADO 实体数据模型。当我为 oracle 创建 ADO 时,我不得不将实体框架版本从 6 降级到 5。
模型.Context.cs
namespace DataManger.Entity
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class myEntities : DbContext
{
public myEntities()
: base("name=myEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<Application> Applications { get; set; }
现在,当我尝试在“实体”中获取任何模型时。
using DataManager.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
namespace DataManager.Services
{
public class ApplicationDataService : IApplicationDataService
{
使用 DataManager.Entity 时,我在第一行收到以下错误消息
严重性代码描述项目文件行抑制状态错误 CS0234 名称空间“DataManager”中不存在类型或名称空间名称“Entity”(您是否缺少程序集引用?) DataManger ......
解决方案
推荐阅读
- kubernetes - 是否可以在 GKE 集群上创建 Ingress 资源并强制它使用现有的 HTTP(S) 负载平衡器?
- html - 如何在CSS上的各种项目中修复按钮内文本的位置
- php - 具有计算和舍入的 MassUpdate
- google-chrome - 无法安装站点:页面没有清单URL
- sql - 查询以下内容的最佳或最简单方法是什么
- wordpress - 加载简码 Wordpress 直到页面加载完成
- html - SVG(?)导致空白
- python - 在弧形补丁之间填充 - Matplotlib
- firebase - 有没有办法从 Google Endpoints 调用 firebase 可调用函数
- php - php list - 将项目放在单独的行上