c# - Entity Framework - The type of column 'ColumnName' is not supported. The type is 'Object' -
i wrote piece of code 6 months ago, worked fine , deployed in multiple environments. have got new enhancement , when try run same code, strangely gives me error. search online nothing helpful. below code in concern:
var parameter = new sqlparameter("@searchcriteria", sqldbtype.structured); parameter.value = searchcriteria; parameter.typename = "dbo.searchcriteria"; var output = entities.database.sqlquery<tablename>( "dbo.storedprocedurename @searchcriteria", parameter).tolist<tablename>();
it gives me error
the type of column 'selectedvalue' not supported. type 'object'.
the same deployed code still in running on other servers without issues. not sure changed in pc!!
my table type definition:
create type [dbo].[searchcriteria] table( [selectedattribute] [varchar](50) null, [selectedcriteria] [varchar](50) null, [selectedvalue] [varchar](50) null)
i believe error not coming out of stored procedure coming in ado.net / entity framework before calling stored procedure. kept trace using sql profile call did never hit db. tried run sp directly on ssms , sp working fine. so, see either entity framework or ado.net.
i had object in c# stores searchcriteria , gets converted datatable before being sent stored procedure using ef.
one of fields "selectedvalue" declared "object". changed "string" , working fine.
i have absolutely no idea how code has been working far , why broke now!! 1 wrote , i'm modified no middle person changes :)
old class:
public class selectioncriteria { public string selectedattribute { get; set; } public string selectedcriteria { get; set; } public object selectedvalue { get; set; } }
modified class:
public class selectioncriteria { public string selectedattribute { get; set; } public string selectedcriteria { get; set; } public string selectedvalue { get; set; } }
Comments
Post a Comment