StackTrace = " at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)\r\n at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__0[TResult](IEnumerable`1 sequence)\r\n at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult]...
在突然无法使用实体框架从表中获取任何记录之前它正在工作
不知道在没有对 edmx 文件进行任何更改之前它工作正常的问题是什么
public bool SetClientIdForUser(string username, string clientId)
{
aspnet_Users aspnetUsers = _objVaccinationContext.aspnet_Users.First(t => t.UserName == username);
//aspnetUsers.Client_Id = clientId;
aspnetUsers.Client_id = clientId;
var entry = _objVaccinationContext.Entry(aspnetUsers);
entry.State = EntityState.Modified;
_objVaccinationContext.SaveChanges();
return true;
}
连接字符串: <add name="ChildVaccinationEntities" connectionString="metadata=res://*/ChildVaccinationContext.ChildVaccination.csdl|res://*/ChildVaccinationContext.ChildVaccination.ssdl|res://*/ChildVaccinationContext.ChildVaccination.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog=CVSUAT;user id=sa;password=Password123;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
注意:我表中的第一条记录是我想要获取的记录,因此无法使用任何其他功能