简体   繁体   English

带有 SAP HANA 的实体框架

[英]Entity framework with SAP HANA

I have built a WPF application with Entity Framework on SQL Server as database.我在 SQL Server 上构建了一个带有实体框架的 WPF 应用程序作为数据库。 I am trying to migrate the same application with SAP HANA as database.我正在尝试使用 SAP HANA 作为数据库迁移相同的应用程序。 Following the same approach, I have created the tables in HANA db and now trying to add an entity model in the solution by following this SAP help: SAP HANA Client Interface Programming Reference按照相同的方法,我在 HANA db 中创建了表,现在尝试按照此 SAP 帮助在解决方案中添加实体模型: SAP HANA 客户端接口编程参考

While adding the entity model, after selection of data source and option to include sensitive data in connection string, the wizard disappears.添加实体模型时,在选择数据源和在连接字符串中包含敏感数据的选项后,向导消失。 Please help if anyone has used entity framework with HANA.如果有人在 HANA 中使用过实体框架,请提供帮助。

I have used all the 32 bit versions of HANA client available on SAP market place without any success.我已经使用了 SAP 市场上可用的所有 32 位版本的 HANA 客户端,但没有任何成功。

You can use Entity Framework by using the adding a reference to the dll provided in the installation directory.您可以通过添加对安装目录中提供的dll的引用来使用 Entity Framework。

The name of the dll is System.Data.CData.SAPHANA.Entities.EF6.dll and you should have installed EntityFramework using Install-Package EntityFramework -Version 6.3.0 command. dll 的名称是System.Data.CData.SAPHANA.Entities.EF6.dll ,您应该已经使用Install-Package EntityFramework -Version 6.3.0命令Install-Package EntityFramework -Version 6.3.0 Please don't forget to use the version flag because it didn't work with another version and I didn't try to know why.请不要忘记使用版本标志,因为它不适用于另一个版本,我也没有尝试知道原因。

Now the remaining thing is the connection string现在剩下的就是连接字符串

<add name="HANA_DbContext" connectionString="Offline=False;User=system;
Password=Secret_Pass;Server=hana.office.internal.com;
Database=company_erp;" providerName="System.Data.CData.SAPHANA" />

Here now, everything should work correctly as if it works MySQL, SQL Server or another ORM现在,一切都应该正常工作,就像它在 MySQL、SQL Server 或其他 ORM 中一样

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

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