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

asked 13 Feb, 11:04

boriska002's gravatar image

boriska002
112
accept rate: 0%

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 ?

(14 Feb, 10:31) JBSchueler

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>

(14 Feb, 13:06) boriska002

I tried with .NET 4.5 & EF6, it works like expected, with this app.config genaration run successfully :

<configuration>
  <configsections>

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirepermission="false"/>
  </configsections>
  <startup>
    <supportedruntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <system.data>
    <dbproviderfactories>
      <clear/>
      <add name="SQL Anywhere 17 Data Provider" invariant="Sap.Data.SQLAnywhere" description=".Net Framework Data Provider for SQL Anywhere 17" type="Sap.Data.SQLAnywhere.SAFactory, Sap.Data.SQLAnywhere.EF6, Version=17.0.0.10094, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
    </dbproviderfactories>
  </system.data>
  <entityframework>
    <defaultconnectionfactory type="Sap.Data.SQLAnywhere.SAConnectionFactory, Sap.Data.SQLAnywhere.EF6, Version=17.0.0.10094, Culture=neutral, PublicKeyToken=f222fc4333e0d400">
    </defaultconnectionfactory>
    <providers>
      <provider invariantname="Sap.Data.SQLAnywhere" type="Sap.Data.SQLAnywhere.SAProviderServices, Sap.Data.SQLAnywhere.EF6, Version=17.0.0.10094, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
    </providers>
  </entityframework>
<connectionstrings><add name="Entities" connectionstring="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Sap.Data.SQLAnywhere;provider connection string='UserID=dba;Password=sql;DataSourceName="SQL Anywhere 17 Demo"'" providername="System.Data.EntityClient"/></connectionstrings></configuration>

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) :

<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>
  <startup>
    <supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  <system.data>
    <dbproviderfactories>
      <clear/>
       <add name="SQL Anywhere 11 Data Provider" invariant="iAnywhere.Data.SQLAnywhere" description=".Net Framework Data Provider for SQL Anywhere 11" type="iAnywhere.Data.SQLAnywhere.SAFactory, iAnywhere.Data.SQLAnywhere.v4.0, Version=11.0.1.29604, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
    </dbproviderfactories>
  </system.data>
  <entityframework>
    <defaultconnectionfactory type="iAnywhere.Data.SQLAnywhere.SAFactory, 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>
<connectionstrings><add name="Entities" connectionstring="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=iAnywhere.Data.SQLAnywhere;provider connection string='DataSourceName="SQL Anywhere 11 Demo"'" providername="System.Data.EntityClient"/></connectionstrings></configuration>
(15 Feb, 10:29) boriska002
Replies hidden

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

(15 Feb, 10:41) boriska002

FWIW, I used a pair of pre-tags to format the code as-is... (but don't know the answer, sorry...)

(15 Feb, 10:42) Volker Barth

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.

(15 Feb, 11:33) JBSchueler

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 ?

(16 Feb, 04:06) boriska002
More comments hidden
showing 5 of 7 show all flat view
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×65

question asked: 13 Feb, 11:04

question was seen: 145 times

last updated: 16 Feb, 04:08