Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

c# - How to access a Oracle Vendor Database via dotnetcore 3.1 console app, I am getting a System.data.entity file not found error

I have been trying some time to access our vendor database resource for plant automation. however as per our agreement with them we can only communicate to their oracle database via dll.

I want to develop an application in dotnetcore 3.1 so that I can expose services (api layer). I coded a simple console application in dotnetcore 3.1 to test reading from the vendor database

here is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VENDOR.DB.Queries;
using Microsoft.EntityFrameworkCore;
using System.Linq.Dynamic.Core;

namespace testVendorDB
{
    class Program
    {
        static void Main(string[] args)
        {
            string strEquipment = "MY_EQUPMENT_33";
            OracleQuery qry = new OracleQuery();
            System.Data.DataTable tabEquipment = new System.Data.DataTable();
            try
            {
                tabEquipment.Clear();
                qry.ConnectionString = "Data Source=WTF_DB;User Id=VEN_DLL;Password=pass;";
                qry.Name = "VENDOR_EQUIPMENT_CURRENT_STATUS";
                qry.Type = EnumQueryType.UserQuery;
                qry.Parameters.Add(new QueryParameter("EQUIPMENT", "string", strEquipment.Trim()));
                tabEquipment = qry.SelectQuery();
            }
            catch (Exception e)
            {
                throw e;
            }
            Console.WriteLine("HELLO WORLD");
            Console.ReadKey();
        }
    }
}

however, I am getting the following error

FileNotFoundException: Could not load file or assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b658589089'. The system cannot find the file specified.

I did proceed to manually include the dll however, I got the bad image exception.

I do realize that dotnetcore doesnt support .net resources, however, I am forced to use the dll for my application. is there anyway I can overcome this challenge?

FYI OracleQuery is from VENDOR.DB.Queries

question from:https://stackoverflow.com/questions/65885081/how-to-access-a-oracle-vendor-database-via-dotnetcore-3-1-console-app-i-am-gett

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...