asp.net - I'm getting a cryptic error connecting a new MVC app to an Azure DB created by mobile services -


like title says, trying connect new mvc 5 app created visual studio 2013 existing database table created , azure mobile service.

i realized issue schema of tables created mobile service. instead of using default "dbo" schema, tables used <mobile_service_name> schema. mvc project looking dbo.<table_name> instead of <mobile_service_name>.<table_name> , throwing error result. fix this, need add mappings in db context class tell find tables looking for. these mappings done in overridden method called onmodelcreating. ends looking this:

public class applicationdbcontext : identitydbcontext<applicationuser> {     public applicationdbcontext() : base("defaultconnection")     {     }      public system.data.entity.dbset<myobject> myobjects { get; set; }      protected override void onmodelcreating(system.data.entity.dbmodelbuilder modelbuilder)     {         base.onmodelcreating(modelbuilder);         modelbuilder.entity<myobject>().totable("<mobile_service_name>.<table_name>");     } } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -