Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to "EnforceConstraints" to avoid linq errors?
    primarykey
    data
    text
    <p>I'm working on a sample from the book I bought. And, for unknown reason, I get the following error message " <strong>Could not find an implementation of the query pattern for source type 'System.Type'. 'Where' not found.</strong>" </p> <p>The VS2008 help says that I need to add System.Linq and System.Collections namespaces to solve the issue. Unfortunatelly, I still get the same error message. In MSDN forum, it said that I need to set EnforceConstraints to true;</p> <p>I would like to know what's "EnforceConstraints" and how can I do it.</p> <p>Thanks. </p> <hr> <h1>Here is the code</h1> <p>using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web.Mvc; using Castle.Windsor; using Castle.Windsor.Configuration.Interpreters; using Castle.Core.Resource; using System.Reflection; using Castle.Core; using System.Collections;</p> <p>namespace WebUI { public class WindsorControllerFactory : DefaultControllerFactory { WindsorContainer Container;</p> <pre><code> public WindsorControllerFactory() { //Instatiate a container, taking configuration from web.conf Container = new WindsorContainer( new XmlInterpreter(new ConfigResource("Castle")) ); //Also register all the controller types as transient var controllerTypes = from t in Assembly.GetExecutingAssembly().GetType() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) Container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); } //Constructs the controller instance needed to service each request protected override IController GetControllerInstance(Type controllerType) { return (IController)Container.Resolve(controllerType); } }//The constructor } </code></pre> <hr> <p>The sample is on page 98.</p> <p>the book is "Pro ASP.NET MVC Framework"/Steven Sanderson/APress ISBN-13 (pbk): 978-1-4302-1007-8 </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload