c# - Subsonic query to determine if value starts with numeric -


this follow-up of this question, context has changed. breaking accepted solution.

this time i'm trying use subsonic, throws errormessage using previous accepted solution

system.notsupportedexception: method 'get_chars' 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 can tell q.brukerident string. i'm bit thrown...

forget linq - don't use it. there better way accomplish goal. use sql. you'd done already if would've used sql - it's basic pattern search.

subsonic? use codinghorror , use appropriate sql.

codinghorror class in subsonic assembly. gives way execute specific, hand-written sql instances trying achieve same result linq difficult if not impossible, , therefore complete waste of time.

you can execute codinghorror query , ask give results list of strongly-typed objects.

here's use of codinghorror should solve problem, you'll have fill in couple of particulars (table name, type name).

var query = new codinghorror(@"select * yourtablehere                                 brukerident '[a-z0-9]%'"); var matchingitems = query.executetypedlist<yourtypehere>(); 

also, there's been bit of exodus using subsonic, , larger orm's in general. recommend looking @ petapoco (or massive or dapper, etc.). author of petapoco driven experience of having use codinghorror far in projects utilized subsonic.


Comments