2023年5月4日 星期四

.Net Entity Framework Core for SAP HANA

 參考文件 :   Connect Using the Microsoft Entity Framework Core (EF Core)

1.先下載 HDBClient 並安裝,在新的版本才會有 dotnetcore目錄及 dll檔

目前只支援 Entity Framework Core 6的版本,所以記得專案 .csproj 的 PackageReference 版本只能是 6如 6.0.14,不能是最新版本的 7.0.0 ,不然會出現 Method not found: 'Void CoreTypeMappingParameters..ctor 的錯誤

 

2023/12/29 新版的 HDBClient開始支援 7版,請參考  Entity Framework Core Support (SAP HANA Data Provider for Microsoft ADO.NET)

 

2. 專案 .csproj 需要新增加 Reference

<Reference Include="Sap.Data.Hana.Core.v2.1">        

    <HintPath>[hdbclient path]\dotnetcore\v2.1\Sap.Data.Hana.Core.v2.1.dll</HintPath>

</Reference>

<Reference Include="Sap.EntityFrameworkCore.Hana.v6.0">

    <HintPath>[hdbclient path]\dotnetcore\v6.0\Sap.EntityFrameworkCore.Hana.v6.0.dll</HintPath>

</Reference>

3. connectstring 設定 CS參數指定資料庫

Server=[ip:port];UserName=[username];Password=[passwd];CS=[database name]

因為要 到 SAP ME,所以要先指定一個資料庫



沒有留言:

張貼留言