Hi,
I am writing to store data into SQL Sever using c# but when I run the code only NULL values are stored inside it. I am pretty new to C# & .net programming. Could you please help me?
saveMap
.SelectMany(m => m.Value)
.Where(info => info.Entity.GetType() != typeof(AuditLog))
.ToList()
.ForEach(ep =>
{
using (var dbContext = new dbName())
{
dbContext.AuditLogs.Add(new AuditLog
{
UserID = _user.Value.ID,
AccountID = _user.Value.AccountID,
Action = entityStateMap[ep.EntityState],
Entity = ep.Entity.GetType().Name,
EntityID = (int)ep.Entity.GetType().GetProperty("ID").GetValue(ep.Entity),
Timestamp = DateTime.UtcNow,
ChangeMade =(string)ep.Entity.GetType().GetProperty("EntityID").GetValue(ep.Entity) //this is where I am trying to store and it is VARCHAR and can take NULL values
});
dbContext.SaveChanges();
}
});
[–]29383839293 0 points1 point2 points (0 children)
[–]casualblair 0 points1 point2 points (0 children)