Cleanest Way To Map Entity To DTO With Linq Select?

Just use AutoMapper. Example: Mapper.CreateMap<Address, AddressDTO>(); Mapper.CreateMap<Person, PersonDTO>(); Your query will execute when the mapping is performed but if there are fields in the entity that you’re not interested use Project().To<> which is available both for NHibernate and EntityFramework. It will effectively do a select on the fields specified in the mapping configurations.

Strange LINQ To Entities Exception

This is a guess, but I think your anonymous type might be attempting to duck-type to an enum when you’ve got more than two queries. If that’s happening, then you’ll get this complaint about not implementing IConvertible, as enum implements IConvertible, and your anonymous type (now derrived from enum) does not implement the interface.

Semaphore exception – Adding the specified count to the semaphore would cause it to exceed its maximum count

In my case, the problem was that I stopped the application while debugging. The application was making a lot of async callings. So I reset my IIS server: iisreset via Command Prompt or PowerShell, and it worked. EDIT: Look at the @aaroncatlin comment for IIS Express

Joining tables using more than one column in Linq To Entities

You can write it using two from expressions like below: from a in Table1s from b in Table2s where a.ID1Table1 == b.ID1Table2 && a.ID2Table1 == b.ID2Table2 select new {a.ID1Table1, a.ID2Table1, a.Value1Table1, b.ID3Table2, b.Value1Table2} Using join: from a in Table1s join b in Table2s on new{PropertyName1 = a.ID1Table1, PropertyName2 = a.ID2Table1} equals new{PropertyName1 = b.ID1Table2, PropertyName2 … Read more

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