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; ...
my spider have serious memory leak.. after 15 min of run memory 5gb , scrapy tells (using prefs() ) there 900k requests objects , thats all. can reason high number of living requests objects? request goes , doesnt goes down. other objects close zero. my spider looks this: class externallinkspider(crawlspider): name = 'external_link_spider' allowed_domains = [''] start_urls = [''] rules = (rule(lxmllinkextractor(allow=()), callback='parse_obj', follow=true),) def parse_obj(self, response): if not isinstance(response, htmlresponse): return link in lxmllinkextractor(allow=(), deny=self.allowed_domains).extract_links(response): if not link.nofollow: yield linkcrawlitem(domain=link.url) here output of prefs() htmlresponse 2 oldest: 0s ago externallinkspider 1 oldest: 3285s ago linkcrawlitem 2 oldest: 0s ago request ...
Comments
Post a Comment