我有一个较旧的项目正在使用
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">
和其中的连接
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="userid=dba;password=PASSWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01"" 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="userid=dba;password=PASSWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01"" providerName="System.Data.EntityClient"/>
</connectionStrings>
然后我将2个文件更改为
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">
和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="userid=dba;password=PASWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01"" 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="userid=dba;password=PASWORD;databasename=swat;servername=LAPTOP-0IMGM8KC;host=127.0.01"" providerName="System.Data.EntityClient"/>
</connectionStrings>
我编译了它,似乎可以正常工作,但是没有创建数据库表等,有什么建议吗?
这里有更多的EDMX
我看到它引用了一个schemaGenerator
<?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" />