c# - DbContext.Database.SqlQuery returns some null objects -
c# - DbContext.Database.SqlQuery returns some null objects -
using entity framework 6
, code below queries table (really, view) , returns number of rows. number of rows correct, many of rows null, i.e. of licenses
objects null, seen in visual studio watch window. think happening if column of given row in view contains null, entire row beingness set null. ideas on how right data?
string query = "select * dbo.v_licenses [number] '%ab%'"; system.data.entity.infrastructure.dbrawsqlquery<licenses> dbrawsqlquery = db.database.sqlquery<licenses>(query); queryable<licenses> licenses = dbrawsqlquery.asqueryable();
based on this question seems ef (at to the lowest degree @ 1 point) returned null
objects if first column of result set null
. rather selecting *
should explicitly name columns , ensure pk (or other column) first.
c# sql entity-framework
Comments
Post a Comment