.net-4.0

Target Framework change 4.0 to 3.5 breaks EF model. Error 111: Referential constraint errors

帅比萌擦擦* 提交于 2019-12-23 15:34:53
问题 I created a EF model in a library project which targets .NET framework 4.0. I just downgraded it to target framework 3.5 instead since one of the projects that will be using this library targets 3.5 and cannot be upgraded at the moment. After changing the target framework from 4 to 3.5, I am getting multiple 111 errors similar to: Error 111: Properties referred by the Dependent Role WfInstance must be a subset of the key of the EntityType xx.Entity.WfInstance referred to by the Dependent Role

ConcurrentDictionary doesn't seem to mark elements for GC when they are removed

混江龙づ霸主 提交于 2019-12-23 15:10:31
问题 I was surprised to find that my app memory footprint kept growing - the longer it run, the more memory it consumed. So with some magic of windbg I pinpointed a problem to my little LRU cache based on ConcurrentDictionary . The CD has bunch of benefits that were very cool for me (one of which is that its data never ends up in LOH). TryAdd and TryRemove are two methods used to add and evict items. !gcroot of some older element lead me back to my cache. Some investigation with ILSpy led me to

Microsoft Likes the False value better?

淺唱寂寞╮ 提交于 2019-12-23 14:24:46
问题 Im reading Jon Skeet book. (#4) but one thing (among others) caught my eye : topic : bool? he wrote in a table that :(X,Y are bool?) X | Y | X & Y --------------------------- true null null ok fine... so the null is the one who decides. the bool operand here looses. X | Y | X & Y --------------------------- false null false why ? why the bool operand here is being taking into account while in the previous sample it was the null who decided about the result ...? It seems that true and false

Do I need 2 Comparer<T> for sorting in both directions?

自闭症网瘾萝莉.ら 提交于 2019-12-23 13:16:14
问题 If I create a Comparer<T> for the purposes of sorting a set of objects, is there a simple way to 'invert' it so I can sort in the other direction? Or do I need to define a 2nd Comparer<T> with the tests in the Compare method swapped around? 回答1: public class ReverseComparer<T> : Comparer<T> { private Comparer<T> inputComparer; public ReverseComparer(Comparer<T> inputComparer) { this.inputComparer = inputComparer; } public override int Compare(T x, T y) { return inputComparer.Compare(y, x); }

DirectShow cast sampleGrabber to ISampleGrabber

℡╲_俬逩灬. 提交于 2019-12-23 13:00:00
问题 I have a strange error that I cannot wrap my head around. I have a graph created in a separate thread that runs and I'm trying to access the IBaseFilter sampleGrabber outside the thread which worked in a console application but I moved the code to a new project and where I'm trying to cast sampleGrabber to ISampleGrabber the runtime complains with a null reference exception. If I debug sampleGrabber it does have the interface ISampleGrabber however I cannot cast it anymore. Moving the code

How to get CheckedListBox.checkedItems as a stringlist

巧了我就是萌 提交于 2019-12-23 12:55:19
问题 I am trying to get CheckedListBox.CheckedItems as a StringList. But I don't know how to get it. I am trying to make it as a one liner using LINQ. My insufficient experience in .Net-C# is not capable to do that. Can anybody say how to do that? Note: I am using .Net-4.0. 回答1: If the values you stored in those items are strings: List<string> items = chk.CheckedItems.Cast<string>().ToList(); If they are of some custom type you could use that type: List<SomeTypeUsedForTheItems> items = chk

how to execute string path on dynamic type?

拥有回忆 提交于 2019-12-23 12:25:40
问题 Is it possible to execute string path on dynamic type? For example having dynamic type we can write dynamic d = myObj; var v = d.MyMethod(1,"text").SomeProperty.Name Now imagine I have string path string path = "MyMethod(1,\"text\").SomeProperty.Name"; var v = d. //How to applay string path to this type? 回答1: I have solution using extension method and reflection, you need to optimize and test for different scenario. EDIT Still dirty code, but supports overloaded method now. I will try to do

Does XPath do short-circuit evaluation of logical expressions?

妖精的绣舞 提交于 2019-12-23 11:49:02
问题 My question is regarding the order of execution in XPath. I have an expression such as: //person[@created and customFunction(.)] My problem is that my custom function is quite compute heavy and I only wish for it to run on nodes that have the created attribute set. Will @created always be evaluated before customFunction ? I could cook up a program to test this, but in reality the success of such an experiment is no guarantee, at least not in the long term. If this is a matter of XPath

Does XPath do short-circuit evaluation of logical expressions?

懵懂的女人 提交于 2019-12-23 11:48:40
问题 My question is regarding the order of execution in XPath. I have an expression such as: //person[@created and customFunction(.)] My problem is that my custom function is quite compute heavy and I only wish for it to run on nodes that have the created attribute set. Will @created always be evaluated before customFunction ? I could cook up a program to test this, but in reality the success of such an experiment is no guarantee, at least not in the long term. If this is a matter of XPath

Issue connecting to Server from WCF Client - HTTPS endpoint - Works on Local Dev but not Server

孤街浪徒 提交于 2019-12-23 11:39:08
问题 UPDATE LOG: Added more detail - Included the WCF Trace. Firstly, not a lot of WCF experience, so apologies if this is an obvious error. I'm writing a simple console application, that needs to connect to a third-party SOAP web service. The WSDL supplied by the supplier is here: http://pastebin.com/LJurv0qA I have used this to create a Service Reference within Visual Studio 2010 (Using .NET 4.0) to create the auto-generated code behind. I have also setup the app.config for the various