I am an old ADO.net programmer and am now porting over my legacy code to entity.
I have been stuck now for about a day trying to understand something and not finding much help online so here I am
I am using the using construct to open my entity connection, something like (in VB)
Using context As New IT_MasterDBContext(...connection info here ...)
sql = "select * from table where ID = 10" ' let's say, for example there are 100 rows in this table and 10 have ID = 10
context.table.sqlquery(sql).ToList
END USING
I don't get any errors, however the where clause seems to be ignored. No matter what sql query I write (oddly enough I can even write sql="*" as the sql string) and I still get 100 rows
sql = "select * from table" >> returns 100 rows
sql = "select top 5 * from table" >> returns 100 rows
even
sql = "*" >> returns 100 rows
Obvioulsy I am making a mess of the use of SqlQuery and or the .ToList attribute of the DBset, can someone enlightened and old and confused programmer?
Thanks in advance and Merry Christmas