Linq to SQL (Single method missing) RRS feed

  • Question

  • I have got a very odd problem that I think might have something to do with web.config, but I am not sure.  I created a project in vs2008 (web) and used linq to sql without too many troubles and generated code as follows:

    Code Snippet

    Dim ikura As Product = db.Products.Single(Function(p As Product) p.ProductName = "Ikura")

    However, I just imported an old web and added LINQ to it and generated my DBML files and went to use the syntax above and the intellisence does not show that there is a .Single method anywhere on any of my datacontext objects.

    I am fairly certain this is a setting somewhere... but not sure where...Will continue looking and if I solve it before this post is answered, I will post an update. 


    Sunday, March 30, 2008 5:48 AM


  • Wow .. that was fast.. I fixed it!... it was web.config and I think it was missing a reference to system.xml.linq.  Don't ask my WHY.. I have no idea.. but when I added that reference along with the following codeblock to my web.config file it worked.. the single method shows up now.. if anyone can explain why this is, I would be greatful...

    Code Snippet

                    <add namespace="System"/>
                    <add namespace="System.Collections"/>
                    <add namespace="System.Collections.Generic"/>
                    <add namespace="System.Collections.Specialized"/>
                    <add namespace="System.Configuration"/>
                    <add namespace="System.Text"/>
                    <add namespace="System.Text.RegularExpressions"/>
                    <add namespace="System.Linq"/>
                    <add namespace="System.Xml.Linq"/>
                    <add namespace="System.Web"/>
                    <add namespace="System.Web.Caching"/>
                    <add namespace="System.Web.SessionState"/>
                    <add namespace="System.Web.Security"/>
                    <add namespace="System.Web.Profile"/>
                    <add namespace="System.Web.UI"/>
                    <add namespace="System.Web.UI.WebControls"/>
                    <add namespace="System.Web.UI.WebControls.WebParts"/>
                    <add namespace="System.Web.UI.HtmlControls"/>
                    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    Sunday, March 30, 2008 5:53 AM