问题
Is it possible to parse criteria from string?
回答1:
You're not giving anyone much to go on, so I'll just have to take a guess at what you're trying to ask...
If you're looking for a simple criteria.Parse("string here");
then no, I don't such a thing exists.
However, the criteria interface lends itself very well to dynamic creation (in fact, that's its intended purpose). As such, yes, you could write a string parser to create ICriteria
elements from tokens.
Perhaps if you provide more information on the problem you are trying to solve someone can respond with a better answer.
来源:https://stackoverflow.com/questions/930131/parsing-criteria-in-nhibernate