Using System.Data.Linq in a Razor view

You need to import the namespace into your view by adding @using System.Data.Linq at the top of your view. However if you want it in all your views then you need to add <add namespace=”System.Data.Linq” /> to the web.config in your Views folder: <system.web.webPages.razor> <host factoryType=”System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ /> <pages pageBaseType=”System.Web.Mvc.WebViewPage”> <namespaces> <add … Read more

Linq-to-sql orderby thenby

How can I do an orderby thenby using the above syntax without using extension syntax. Use a comma between the fields: orderby a, b And what does the orderby, orderby do? When you use orderby twice in a row the elements conceptually will first be sorted using the first orderby, and then sorted again using … Read more

Should I return IEnumerable or IQueryable from my DAL?

It depends on what behavior you want. Returning an IList<T> tells the caller that they’ve received all of the data they’ve requested Returning an IEnumerable<T> tells the caller that they’ll need to iterate over the result and it might be lazily loaded. Returning an IQueryable<T> tells the caller that the result is backed by a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)