NOLOCK with Linq to SQL

Yes it is, so here’s the entry from my blog: The NOLOCK hint is essentially the same as wrapping a query in a transaction whose “isolation level” is set to “read uncommitted”. It means that the query doesn’t care if stuff is in the process of being written to the rows it’s reading from – … Read more

How to do Select All(*) in linq to sql

from row in TableA select row Or just: TableA In method syntax, with other operators: TableA.Where(row => row.IsInteresting) // no .Select(), returns the whole row. Essentially, you already are selecting all columns, the select then transforms that to the columns you care about, so you can even do things like: from user in Users select … Read more

Missing LINQ to SQL Classes (DBML designer) in Visual Studio 2017 RC

You need to opt in to enable the designer during installation, it is not enabled by default: https://developercommunity.visualstudio.com/content/problem/4616/linq-to-sql-dbml-designer-in-not-working.html “Editing .dbml files with a designer surface requires the LINQ to SQL tools which are not installed by default as part of any of the workloads of Visual Studio 2017. It can be installed by selecting the … Read more

Is LINQ to SQL Dead or Alive?

1) They can’t “kill” Linq-to-SQL as it is already part of the .net framework. What they can do is stop adding features to it. That doesn’t prevent the thousands of developers out there that are already using L2S from extending it and improving it. Some core areas are tricky to touch but they’re solid already … Read more

How to do a join in linq to sql with method syntax?

var result = from sc in enumerableOfSomeClass join soc in enumerableOfSomeOtherClass on sc.Property1 equals soc.Property2 select new { SomeClass = sc, SomeOtherClass = soc }; Would be equivalent to: var result = enumerableOfSomeClass .Join(enumerableOfSomeOtherClass, sc => sc.Property1, soc => soc.Property2, (sc, soc) => new { SomeClass = sc, SomeOtherClass = soc }); As you can … Read more

How do I update a Linq to SQL dbml file?

There are three ways to keep the model in sync. Delete the modified tables from the designer, and drag them back onto the designer surface from the Database Explorer. I have found that, for this to work reliably, you have to: a. Refresh the database schema in the Database Explorer (right-click, refresh) b. Save the … Read more