In my database i have table what contains a file name pattern.
Pattern in database:
PKO??_??_??????_*.TXT
File name:
PKO10_11_123456_example.TXT
Now when some file is imported to my program i need to match it against these patterns in database. I know that Directory.GetFiles() has this option to add the pattern and it give back all the files what will match with this patter. Is there a way i can do that in LINQ query? I tried Containes() like this:
var _cardType = (from type in context.OCA_CARD_TYPEs
where type.FILENAME.ToLower().Contains(fileName.ToLower())
select type).Single();
But like that i didnt get any match.
with
filenameas@"PKO__\___\_______\_%.TXT"and note that the
\_are the literal_(escaped via the\character we specified) – the_and%are theLIKEwildcards akin to?and*respectively.