I have a class that looks like this:
public class Analyst
{
[Column("Internal_ID")]
public int ID { get; set; }
[Column("DisplayName")]
public string Name { get; set; }
}
This object is populated like this (this next part is in the class that inherits from DbContext):
public List<T> ExecProc<T>(string proc, Dictionary<string, object> params)
{
var parms = new List<SqlParameter>();
var sql = new StringBuilder();
sql.Append(sproc.StoredProcedure);
sql.Append(" ");
foreach (var key in sproc.Parameters.Keys)
{
sql.Append(string.Format("{0},", key));
parms.Add(new SqlParameter(key, sproc.Parameters[key]));
}
if (sql[sql.Length - 1] == ',')
{
sql.Remove(sql.Length - 1, 1);
}
return Database.SqlQuery<T>(sql.ToString(), parms.ToArray()).ToList();
}
The returned list contains the correct number of rows (or objects in this case), but none of the properties are filled with values. If proc returns 200 rows, then I get 200 objects in the List, but none of them matter.
, [Column ( "name" )] . , , , . - , ? , - .
: Visual Studio 2010 Ultimate SP1,.Net 4 SP1, EF 4.2.0 ( EF 4.3). , .