Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
.net android asp.net asp.net mvc azure backup bigdata book business intelligence c# community continuous delivery database denali excel gotcha how to indexing java mongodb mvc music store nancy nhibernate nosql performance powershell security silverlight sql sql advent 2012 sql friday sql server sql server 2000 sql server 2005 sql server 2008 sql server 2008 r2 sql server 2012 sql server denali ssis ssms ssrs structuremap syndicated t-sql teamcity tip unit testing vb.net visual studio 2010 windows 7
- SQLDenis (597)
- Christiaan Baes (chrissie1) (544)
- Ted Krueger (onpnt) (345)
- Jes Schultz Borland (grrlgeek) (146)
- Eli Weinstock-Herman (tarwn) (130)
- Alex Ullrich (52)
- George Mastros (gmmastros) (46)
- Koen Verbeeck (44)
- Naomi Nosonovsky (27)
- Axel Achten (axel8s) (27)
- David Forck (thirster42) (22)
- chopstik (20)
- Kevin Conan (18)
- Rob Earl (14)
- thatrickguy (12)
One of the projects I have been working on is a system for managing content on our network of websites. One of our requirements is that changes don't take effect immediately, but on a separate preview network where our customer can look to see that her…
From time to time I answer a few questions on Stackoverflow, mostly because you can learn a lot from someone else's problems and it makes you think. This time the problem was simple and it seems like most people revert to a for loop loop to solve it. While using linq is so much shorter easier to read.
I think this was the first time I ever used the Select extension method. And it gave me an unexpected result.
First I created a Person Class.
I'm using NHibernate version 2.1.2 GA and the 2.1.2 Linq version that goes with it.
And I like to state that I'm not complaining, but perhaps I can save some people from losing too much time while trying this. You still have plenty of other options if Linq does not work in your situation.
So let's say I have this Person Object
Ok, time to try the linq to nhibernate subquery possibilities.
Let's say I have a object called TexCase that has a collection of Tags Of Type Tag. And the Class Tag has a property called Tag of type string.
So I have this HQL query.
Today I thought it would be good to try some Linq to nHibernate while I was waiting for VS2010 to finish downloading.
Last week I was asked to create a normalisation routine for the Msp spectra that my application uses. No worry if you don't know what Msp is. The thing is that it needed to find the maximum value in a collection of values and then do a calculation with that number over the other values in that collection.
First the value object.
In an ICollection(of T) you have a contains method to see if your collection has the requested element in it. But if you want to look for Multiple elements, you have to resort to making predicates (and we all know how ugly those get).
So why didn’t MS implement ContainsAny (OR) and/or ContainsAll (AND). I couldn’t think of a good reason, so I made them myself. They are perhaps a bit over easy and not very performance friendly but they work.
Here are the extension methods.
I keep forgetting that it needs the System.linq namespace to work. And I keep forgetting that it is not set by default on my projects. I try not to overuse linq but sometimes it is easy.
So what happened?
I was trying this:
Adam Machanic created an item on connect explaining how LINQ to SQL queries involving strings cause SQL Server procedure cache bloat
If an application is using LINQ to SQL and the queries involve the use of strings that can be highly variable in length, the SQL Server procedure cache will become bloated with one version of the query for every possible string length. For example, consider the following very simple queries created against the Person.AddressTypes table in the AdventureWorks2008 database:
:: Next >>