Have created two table 'UserShoppingItems'
& 'UserShoppingBills'
both in Azure database and local database (sqlexpress 2008 r2). I had manually created entity mapping for the tables using dbcontext class (not used ado.net entity database wizard) like 'UserShoppingItem'
and mapping with the following code.
"public DbSet<UserShoppingItem> UserShoppingItems {get; set;}"
I could see that table exists in both local and azure server, but when I was running the site from azure, got an error message
Invalid object
'dbo.UserShoppingItems'and Invalid column name 'ShopId' from 'dbo.UserShoppingBills'
.
The site is built using asp.net mvc 4 and entity framework 6.1.*. Entity framework has correctly guessed the name of the table but it could not find it. Even I have tested the azure database with my local web server from visual studio, queried the database from SSMS all are working fine except when running the site from azure web server. Please help me identify the bottleneck of the issue.
EDIT:
public class UserShoppingItem
{
[Key]
[System.ComponentModel.DataAnnotations.Schema.Column(Order=0)]
public Int64 UserId { get; set; }
[Key]
[System.ComponentModel.DataAnnotations.Schema.Column(Order=1)]
public Int64 ShopId { get; set; }
public int? ItemId { get; set; }
}
Azure DB Server - Connection string
As I have not used ado.net entity data model wizard to generate entities there is no need for use metadata=res:///xxx.csdl|res:///xxx.ssdl|res://*/xxx.msl;
<add name="xxxx" providerName="System.Data.SqlClient" connectionString="Data Source=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxxx_Test;User ID=xxxx@xxxx;Password=xxxxxx;MultipleActiveResultSets=True" />
Local DB Server - Connection String
<add name="xxxx" providerName="System.Data.SqlClient" connectionString="Data Source=.\sqlexpressr2,49454;Initial Catalog=MappedGeoDatabase-Dev;User ID=xxxx;Password=xxxx"/>