I'm using Entity Framework 6.0.2; I was using a previous version before I started getting this error.
Basically, I set my models with "string" properties and execute a query or stored procedure and dump the results out as strings, this has always worked.
Any ideas how to fix? Perhaps a "Convention" I could use for the conversion?
Ex:
SQL:
select ROW_NUMBER() OVER (ORDER BY (select Null)) AS Id, '0', 'Test0', 'some kind of data', 'Test1', 'possibly a datetime type', 'Test2'
C#:
public class SomeModel
{
public int Id { get; set; }
public string Test0 { get; set; }
public string Test1 { get; set; }
public string Test2 { get; set; }
}
Invalid Operation Exception:
var records = dbContext.Database.SqlQuery<SomeModel>("select ROW_NUMBER() OVER (ORDER BY (select Null)) AS Id, '0', 'Test0', 'some kind of data', 'Test1', 'possibly a datetime type', 'Test2'").ToList();
.
int Id
?