This is a follow-up of this question, however the context has changed. Breaking the accepted solution.
This time I’m trying to use SubSonic, but it throws an errormessage using the previous accepted solution
System.NotSupportedException: The method 'get_Chars' is not supported
...
Line 36: char[] nums = "0123456789".ToCharArray();
Line 37:
Line 38: var b = repository.GetAll().Where(q => nums.Contains(q.BrukerIdent[0])).ToList();
Line 39:
Line 40:
As far as I can tell q.BrukerIdent is a string. So I’m a bit thrown…
Forget LINQ – Don’t use it. There is a better way to accomplish your goal. Use SQL. You’d be done already if you would’ve just used SQL – it’s just a basic pattern search.
Subsonic? Use a
CodingHorrorand use the appropriate SQL.CodingHorroris a class that is in the SubSonic assembly. It gives you a way to execute specific, hand-written SQL for instances where trying to achieve the same result with LINQ would be difficult if not impossible, and therefore a complete waste of time.You can also execute a
CodingHorrorquery and ask it to give you the results as a list of your strongly-typed objects.Here’s a use of CodingHorror that should solve your problem, but you’ll have to fill in a couple of the particulars (table name, type name).
Also, there’s been a bit of an exodus from using SubSonic, and even larger ORM’s in general. I recommend looking at PetaPoco (or Massive or Dapper, etc.). The author of PetaPoco was driven by his experience of having to use
CodingHorrorfar too often in projects that utilized SubSonic.