Hello guys, today I tried to generate a model for a provided demo db (Visual Studio 2013 Update 5, Sql Anywhere 17.0.4.2053, Entity framework 5.0.0 ) and I got in the output window of VS the exception :The model was generated with warnings or errors.Model.edmx Please see the Error List for more details. In my edmx file I can see : Errors Found During Generation: error 6004: The table '.GROUPO.Customers' is referenced by a relationship, but cannot be found. error 6004: The table '.GROUPO.Contacts' is referenced by a relationship, but cannot be found. <Association Name="FK_Contacts_5_Customers" What I'm doing wrong? Regards, Boris |
It would be handy to know what steps you are performing. Are you following the Database First to an existing database tutorial at http://dcx.sap.com/index.html#sqla170/en/html/37fb9e8558e94547b66156b9298be16f.html ?
Thank you for your enquiry, I installed VS Wizard with SetupVSPackage.exe /i option, I checked also .Net Version: it has to be NET 4.0 in our case, I'm using the ODBC data source to the demo database test connection to which was successfull, in my app.config I can see the following lines:
<configuration> <configsections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirepermission="false"/>
</configsections> <connectionstrings> <add name="Entities3" connectionstring="metadata=res:///Model3.csdl|res:///Model3.ssdl|res://*/Model3.msl; provider=Sap.Data.SQLAnywhere;provider connection string='UserID=dba;Password=sql; DataSourceName="SQL Anywhere 17 Demo"'" providername="System.Data.EntityClient"/> </connectionstrings> <entityframework> <defaultconnectionfactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> <providers> <provider invariantname="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> </providers> </entityframework> </configuration>
I tried with .NET 4.5 & EF6, it works like expected, with this app.config genaration run successfully :
But what should we do, if we use previos versions of sql anywhere /EF ? E.g. I tried to generate model with the following app.config (which failed with foreign keys and navigation properties) :
I tried also with
<entityframework> <defaultconnectionfactory type="iAnywhere.Data.SQLAnywhere.SAConnectionFactory, iAnywhere.Data.SQLAnywhere.v4.0, Version=11.0.1.29604, Culture=neutral, PublicKeyToken=f222fc4333e0d400"> </defaultconnectionfactory> <providers> <provider invariantname="iAnywhere.Data.SQLAnywhere" type="iAnywhere.Data.SQLAnywhere.SAProviderServices, iAnywhere.Data.SQLAnywhere.v4.0, Version=11.0.1.29604, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/> </providers> </entityframework> it doesn't work as exprected
FWIW, I used a pair of pre-tags to format the code as-is... (but don't know the answer, sorry...)
I see you are using Version=11.0.1.29604.
You'll have to upgrade to a newer version (preferably 17.0) to get the most up-to-date Entity Framework support. Version 11.0.1 and 12.0.1 are no longer supported.
Thanks for your suggestion and nice formatting, the problem is that some of our customers still use version 11.0.1.X, referred to https://wiki.scn.sap.com/wiki/display/SQLANY/Using+SQL+Anywhere+and+the+ADO.NET+Entity+Framework it is possible to use EF with Versions up SQL Anywhere 11.0.1.2427, isn't?
So how do we have to configure app.config in order to get it working with .NET 4.0 & EF 5.0.0 ?