c# - Entity Framework throws Invalid object name -


i have db in sql server several tables.

i have created class library project in vs2013. created dbcontext, added database ado.net file , created repository running queries.

i have created web api2 empty project controller creating rest api.

this controller calling library repository running queries, throws exception:

invalid object name 'dbo.tlog' 

the extrange thing table exists in database. query created repository is

select [extent1].[idlog] [idlog],  [extent1].[description] [description],  [extent1].[insertdate] [insertdate] [dbo].[tlog] [extent1] 

and if run in sql server works, in web project doesn't.

the controller looks this:

[route("api/log")] public httpresponsemessage get() {     var logs = myrepository.getalllogs();     httpresponsemessage response = request.createresponse(httpstatuscode.ok, logs);     return response; } 

the repository query is

var query = log in datacontext.log select log; 

my connection string exists in library, connects db, not in web.config of web project, , is:

<connectionstrings>      <add name="myentities" connectionstring="metadata=res://*/mymodel.csdl|res://*/mymodel.ssdl|res://*/mymodel.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=bbbbbbbb;initial catalog=aaaaaaaa;user id=yyyyyy;password=xxxxxxxxx;persist security info=true;application name=entityframework;multipleactiveresultsets=true&quot;" providername="system.data.entityclient" /> </connectionstrings> 

add connection string web.config. class library's app.config not used @ runtime.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -