executestorequery

Entity Framework ExecuteStoreQuery fails on deployed systems

China☆狼群 提交于 2019-12-24 12:29:34
问题 Ok, a bit stumped here, and instead of banging my head any more on this, I thought I'd toss this out to all the bright people here. I'm using Entity Framework and c# for a WinApp solution, and the core of the problem is that the darned thing runs fine on my system, but after I deploy it, it fails. Even when I install the deployed app on my development system, it fails. I find that a bit disturbing. To the nuts and bold of the issue. The user performs a search, I build a query, tap SQL via the

ExecuteStoreQuery with TVP parameters

≯℡__Kan透↙ 提交于 2019-12-07 06:30:17
问题 I have a stored procedure in my database that takes a table value parameter, a list of IdTable objects which contain a single integer Id column. I have an entity model for the database and want to do the following... ProjectEntities projectEntities = new ProjectEntities (); DataTable stationIds = new DataTable(); stationIds.Columns.Add("Id"); stationIds.Rows.Add(1); stationIds.Rows.Add(2); SqlParameter parameter = new SqlParameter("@stationIds",stationIds); parameter.TypeName = "IdTable"; var

ExecuteStoreQuery with TVP parameters

浪子不回头ぞ 提交于 2019-12-05 09:21:54
I have a stored procedure in my database that takes a table value parameter, a list of IdTable objects which contain a single integer Id column. I have an entity model for the database and want to do the following... ProjectEntities projectEntities = new ProjectEntities (); DataTable stationIds = new DataTable(); stationIds.Columns.Add("Id"); stationIds.Rows.Add(1); stationIds.Rows.Add(2); SqlParameter parameter = new SqlParameter("@stationIds",stationIds); parameter.TypeName = "IdTable"; var parameters = new object[] {parameter}; var results = projectEntities .ExecuteStoreQuery<ProjectSummary