none
old EDMX project using "iAnywhere.Data.SQLAnywhere" provider RRS feed

  • Question

  • I have an older project that was using 

    iAnywhere.Data.SQLAnywhere

    SWATModel.edmx:

    <?xml version="1.0" encoding="utf-8"?>
    <edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
      <!-- EF Runtime content -->
      <edmx:Runtime>
        <!-- SSDL content -->
        <edmx:StorageModels>
        <Schema Namespace="SWATModel.Store" Alias="Self" Provider="iAnywhere.Data.SQLAnywhere" ProviderManifestToken="12" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
            <EntityContainer Name="SWATModelStoreContainer">

    and the connection in 

    web.config

      <connectionStrings>
        <add name="SWAT" connectionString="metadata=res://*/Models.SWAT.csdl|res://*/Models.SWAT.ssdl|res://*/Models.SWAT.msl;provider=iAnywhere.Data.SQLAnywhere;provider connection string=&quot;userid=dba;password=PASSWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01&quot;" providerName="System.Data.EntityClient"/>
        <add name="SWATEntities" connectionString="metadata=res://*/Models.SWATModel.csdl|res://*/Models.SWATModel.ssdl|res://*/Models.SWATModel.msl;provider=iAnywhere.Data.SQLAnywhere;provider connection string=&quot;userid=dba;password=PASSWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01&quot;" providerName="System.Data.EntityClient"/>
      </connectionStrings>

    and I changed the 2 files to be 

    SWATModels.edmx:

    <?xml version="1.0" encoding="utf-8"?>
    <edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
      <!-- EF Runtime content -->
      <edmx:Runtime>
        <!-- SSDL content -->
        <edmx:StorageModels>
        <Schema Namespace="SWATModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
            <EntityContainer Name="SWATModelStoreContainer">

    and web.config

      <connectionStrings>
        <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-SWAT-20140409184116;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-SWAT-20140409184116.mdf"/>
        <add name="SWAT" connectionString="metadata=res://*/Models.SWAT.csdl|res://*/Models.SWAT.ssdl|res://*/Models.SWAT.msl;provider=System.Data.SqlClient;provider connection string=&quot;userid=dba;password=PASWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01&quot;" providerName="System.Data.EntityClient"/>
        <add name="SWATEntities" connectionString="metadata=res://*/Models.SWATModel.csdl|res://*/Models.SWATModel.ssdl|res://*/Models.SWATModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;userid=dba;password=PASWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01&quot;" providerName="System.Data.EntityClient"/>
      </connectionStrings>

    I compile it and it seems to work but the database tables etc are not created, any suggestions?

    Saturday, June 27, 2020 3:55 AM

All replies

  • I am confused, because EF using an EDMX does not create database tables.
    Saturday, June 27, 2020 9:50 PM
  • that might be the case 

    i saw this at the end and assumed it was a codse first thimg

    EntityStoreSchemaGenerator
    <?xml version="1.0" encoding="utf-8"?>
    <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
      <!-- EF Runtime content -->
      <edmx:Runtime>
        <!-- SSDL content -->
        <edmx:StorageModels>
        <Schema Namespace="SWATModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
            <EntityContainer Name="SWATModelStoreContainer">
              <EntitySet Name="lkpBiome" EntityType="SWATModel.Store.lkpBiome" store:Type="Tables" Schema="DBA" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
              <EntitySet Name="lkpClimateClassification" EntityType="SWATModel.Store.lkpClimateClassification" store:Type="Tables" Schema="DBA" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
              <EntitySet Name="lkpCountry" EntityType="SWATModel.Store.lkpCountry" store:Type="Tables" Schema="DBA" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
              <EntitySet Name="lkpRegion" EntityType="SWATModel.Store.lkpRegion" store:Type="Tables" Schema="DBA" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
              <EntitySet Name="lkpSoil" EntityType="SWATModel.Store.lkpSoil" store:Type="Tables" Schema="DBA" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />

    Sunday, June 28, 2020 3:41 AM
  • Hi robMerritt,
    >>I compile it and it seems to work but the database tables etc are not created, any suggestions?
    First, edmx file is an XML file that defines an Entity Data Model (EDM), describes the target database schema, and defines the mapping between the EDM and the database. 
    An . edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.
    So as DA924x said, it does not create database tables via using an edmx.
    About using edmx, you can refer to this document
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 29, 2020 6:02 AM
  • Yes I was able to right click on empty space for the EDMX diag and generate database from ed. so I think I am good to go now
    Monday, June 29, 2020 3:41 PM