SDJerry (1) [Avatar] Offline
I've been following along through the examples in the text, and reached Listing 6.21. This requires extending the definition of the Subject class, and the details were not shown in the text, so I went to the code sample, Chapter06to08, and copied the code from the LinqInActionChapter06to08.CSharpCommonSampleClassesCh6Subject.cs and worked with that. I got example 6.21 to work, but when I went on to 6.22, I got a runtime-error:
"The member '<my namespace>.Subject.Books' has no supported translation to SQL." Of course, this could be some error in my code (which I won't post, because that is not the purpose of this Thread). So I wanted to run the 6.22 example in the code sample Chapter06to08, and found that, while there is code in the Ch6Samples.cs, the tree on the left side of the screen does not contain a reference to this example. In fact, it jumps from 6-19 to 6-24. Is there any reason for this? Is there a patch for the Chapter06to08 sample code which I've missed, that will run these examples?
fabrice.marguerie (224) [Avatar] Offline
Re: Missing Examples from Chapter 6
Sorry about that.

The solution is to remove the "static" keyword from the following methods in Chapter06to08.CSharpCommonCodeSamplesCh6Samples.cs: ObjectTrees_6_21, ObjectTrees_6_22, ObjectTrees_6_22a, ObjectTrees_6_23.

Note: another option for running the samples is to use LinqPad. The LINQ in Action samples can be downloaded on the Samples tab.