简体   繁体   English

使用 Entity Framework Code First 连接到带有 devart dotconnect 的旧版 Oracle 数据库

[英]Using Entity Framework Code First to connect to Legacy Oracle Database with devart dotconnect

ERROR: The Type clob is not qualified with a namespace or alias.错误:类型 clob 未使用命名空间或别名进行限定。 Only PrimitiveTypes can be used without qualification.只有 PrimitiveTypes 可以在没有限定的情况下使用。

I have been trying out to use EF 4.1 (code first) with MVC 3, against a legacy Oracle 10g database, using devart dotconnect.我一直在尝试使用 EF 4.1(代码优先)和 MVC 3,使用 devart dotconnect,针对传统的 Oracle 10g 数据库。 The legacy database cannot be changed.不能更改旧数据库。 I'm trying to read the data in it out to a webpage.我正在尝试将其中的数据读入网页。

(Devart.Data.Oracle Version: 5.70.140.0) (Devart.Data.Oracle 版本:5.70.140.0)

I've had a few errors to overcome along the way, but came to this one:在此过程中,我遇到了一些错误需要克服,但来到了这个:

error 0040: The Type clob is not qualified with a namespace or alias.错误 0040:类型 clob 未使用命名空间或别名进行限定。 Only PrimitiveTypes can be used without qualification.只有 PrimitiveTypes 可以在没有限定的情况下使用。

This is my code:这是我的代码:

Web.config connection info: Web.config 连接信息:

<add name="OdeToTrainingCoursesDB"
              connectionString="User Id=test;Password=test;Server=##.#.#.#;
                      Home=OraClient10g;Direct=True; 
                      Sid=dbTest;Persist Security Info=True"
              providerName="Devart.Data.Oracle" />



namespace AllInOne
{
    public class OdeToTrainingCoursesDB : DbContext
    {
        public DbSet<VENUES> VENUES { get; set; }
    }
}



using System.ComponentModel.DataAnnotations;

namespace AllInOne.Models
{
    public class VENUES
    {
        [Key]
        public int VENUE_ID { get; set; }
    }
}

EDIT: Extra info, this is the first table (of many) that I'm trying to read from.编辑:额外信息,这是我试图从中读取的(许多)第一张表。

CREATE TABLE VENUES
(
  VENUE_ID    NUMBER(10)                        NOT NULL,
  VENUE_TYP   VARCHAR2(1 BYTE),
  BASE_ORG    NUMBER(10)                        NOT NULL,
  COUNTY      VARCHAR2(35 BYTE)
)

And the MVC Controller throws this MVC Controller 抛出这个

Local = '(model).Local' threw an exception of type 'System.Data.MetadataException' Local = '(model).Local' 引发了“System.Data.MetadataException”类型的异常

using System.Web.Mvc;

namespace AllInOne.Controllers
{
    public class VenueController : Controller
    {
        readonly OdeToTrainingCoursesDB _db = new OdeToTrainingCoursesDB();
        public ActionResult Index()
        {
            var model = _db.VENUES;

            return View(model);
        }

    }
}

We have replied to you at our forum .我们已经在我们的论坛上回复了您。

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

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