i want store logs in db table (imported ef code). my code looks this: public pmcontext() : base("myentities") { configuration.proxycreationenabled = false; configuration.lazyloadingenabled = false; this.database.log = s => logstore(s); } private void logstore(string message) { tlog log = new tlog(); log.description = message; log.insertdate = datetime.now; logs.add(log); savechanges(); } public virtual dbset<tlog> logs { get; set; } i cannot use savechanges() (get error "sqlconnection not support parallel transactions") , if remove line nothing stored in db table. how can fix this? i think happens during savechanges call anywhere in app, because sql generated call logged, triggers nested savechanges call tries start own transaction. and there thing: savechanges call in logstore method trigger logging itself, you'd end starting infin...
in application i'm working on, programmatically create several frameworkelements differing data sources. unfortunately, data binding failing. i managed distill problem following program: using system.collections.generic; using system.componentmodel; using system.runtime.compilerservices; using windows.ui.xaml; using windows.ui.xaml.controls; using windows.ui.xaml.data; namespace testbinding { public class bindingsource : inotifypropertychanged { public event propertychangedeventhandler propertychanged; protected virtual void onpropertychanged(string propertyname) { propertychangedeventhandler handler = propertychanged; if (handler != null) handler(this, new propertychangedeventargs(propertyname)); } protected bool setfield<t>(ref t field, t value, [callermembername] string propertyname = null) { if (equalitycomparer<t>.default.equals(field, value)) return false; ...
Comments
Post a Comment