2021/11/1

visual studio 2019 新增oracle 連線無法使用entity framework 6

以下內容在2019上,『或許』能成功,但是很繁瑣
目前先把軟體降階到2017
到今日(2021/11/15)有VS2022,但是oracle 的ODP .Net還沒有推出
等有oracle for 2022的再來測試

在選擇entity framewark 的地方,就是一直反灰,無法使用
提示『XXXX找不到資料庫提供者XXXX'
甚至還會在選擇entity framework 版本時,突然消失
怎麼建立都是不行
後來自己找到原因

步驟1.把CPU改成X64,然後重新開啟
步驟2.專案清除。專案重建
步驟3.把6.122.21.1改為4.122.21.1
     <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
          <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,
                    Oracle.ManagedDataAccess.EntityFramework, Version=6.122.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
        </providers>



上述無效,

重新建立app,設定方式如下:

1.app.config裡面有三段,建議保留

<configSections>
    <!--<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />-->
    
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>


<providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=4.122.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>

 

<system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.ManagedDataAccess.Client" />
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=6.122.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
  </system.data>

2.如果要用ADO.net+EF請把EF的版本改掉,由6.122.21.1,變成4.122.21.1


    Oracle.ManagedDataAccess.EntityFramework, Version=6.122.21.1, Culture=neutral,


3.執行的時候,會有異常,除了剛剛的EF變成4.122.21.1,也要把OracleClientFactory,改成4.122.21.1


    Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=6.122.21.1,

正常了


(E04,浪費了我8小時改一個數字,oracle的產品阿......)
(花了一個禮拜的時間....)

補充資訊:
有人提供方向:
https://www.facebook.com/groups/DotNetUserGroupTaiwan/posts/2768088380150929/?comment_id=2768431143449986&notif_id=1636610180937126&notif_t=group_comment&ref=notif
參考頁面
vs 2019 TNS_ADMIN 

 

VS 2019內,建議還是設定好TNS_ADMIN
 在VS選單列,Tools->Options->Oracle Developer Tools ->Connection Configuration

補充:重新閱讀下面內容

https://blog.darkthread.net/blog/managed-odp-net

發現一個問題,關鍵在這一段

注意:Managed ODP.NET支援Entity Framework,但不提供設計階段支援,如果想在Visual Studio使用Entity Framework專案項目,仍須安裝32位元版ODAC with Oracle Developer Tools for Visual Studio,另一方面,開發者通常會用到SQL Plus或第三方Oracle資料庫工具,故開發環境仍會以ODAC 32位元為主,伺服器或大量部署的客戶端才是Managed ODP.NET展現威力的主戰場。

所以,我之前一直有亂七八糟問題,還是要改6->4

但是我還是要『另外安裝』這個『ODAC with Oracle Developer Tools for Visual Studio』

我才能用EF的功能

(oracle的產品阿......)

2021/10/15

RDP自動變更解析度

搜尋關鍵字: mstsc resize window 得到一個答案 Smart Resizing of Remote Desktop Windows
Open the created .rdp file in any editor of your choice, for example, in Notepad, and add the following string at the end of the file: smart sizing:i:1 Make sure that the parameters desktopwidth:i:1280 and desktopheight:i:1024 match the server's desktop resolution. You can also change the color settings. For this purpose, replace the value session bpp:i:8 with the session bpp:i:24 string.
使用notepad開啟保存後的rdp檔案 然後加上這一行 smart sizing:i:1

JPA+complex key+custom Query

  來源: https://www.cnblogs.com/520playboy/p/6512592.html   整個來說,就是有複合主鍵 然後要使用  public interface XxXXxx DAO extends CrudRepository<Tc...