muzu se po****
nenarazil jste nekdy nekdo na to, ze vam na nejake masine "nahodne" skoncila funkce, aniz by dodelala svoji praci? ...
mam tohle (wpf aplikace, EntityFramework6, logovani je pridane ted):
private int leadID;
public int LeadID {
get { return leadID; }
set
{
if (value != leadID)
{
leadID = value;
using (var db = new FormFillLMSEntities(GlobalAppData.GetConnection(AllowedDB.LMS)))
{
db.Database.Log = s => ConsoleMessages.Add(new ConsoleLog() { EventDate = DateTime.Now, Source = "db", Message = s });
ConsoleMessages.Add(new ConsoleLog() { Message = "Lead prefetch: " + leadID.ToString() });
var _lead = db.CEFs.SingleOrDefault(c => c.ID == leadID);
ConsoleMessages.Add(new ConsoleLog() { Message = "Lead fetched: " + (_lead!=null ? _lead.ToString() : "null") });
Lead = _lead;
}
ConsoleMessages.Add(new ConsoleLog() { Message = "Lead after fetched: " + (Lead != null ? Lead.ToString() : "null") });
this.RaisePropertyChanged(() => Lead);
this.RaisePropertyChanged(() => LeadID);
}
}
}
public virtual CEF Lead { get; set; }
a - na vyvojovem pc win10 vse jde jak bych tak nejak ocekaval
ale - na testovaci masine Win Server 2016 Datacenter mi to funguje tak, ze:
pro vetsinu leadid to vrati ocekavany vysledek (tj. nic, pokud lead neexistuje a lead, pokud existuje) s patricnym logovanim, ALE pro nektere id to "skonci" hned po/pri/v zavolani
var _lead = db.CEFs.SingleOrDefault(c => c.ID == leadID);
a to tak, ze entityframework zaloguje uplne totez, co vzdy, vcetne close connection (a v sql profileru vidim, ze to ten query orpavdu nahodi), ale _lead se nenastavi a ConsoleMessage z lead fetched se nezavola
vubec netusim, co hledat, protoze mi to samozrejme funguje i tehdy, kdyz si dev versi napojim na tu samou db, jako nefunguje ta testovaci