LLBLGen Pro:如何评估给定字符串的 EntityField
我有一个 LLBLGen Pro 项目,它生成了 VB.Net 2.0 自助服务代码。
我有一个函数可以根据使用生成的代码的搜索返回自定义结构列表。
我想为此函数提供一个字段名称和值的字典,并为每个字段名称和值的字典添加一个新的谓词表达式到搜索中。
如何检查字典中表示字段名称的字符串并找出要为其添加谓词表达式的 EntityField?
代码示例
Dim dbFiles As New AllFilesCollection
Dim dbFilter As New PredicateExpression
If Not String.IsNullOrEmpty(ClientName) Then
dbFilter.Add(New PredicateExpression(AllFilesFields.ClientMenuName = ClientName))
End If
If Not String.IsNullOrEmpty(SearchText) Then
dbFilter.Add(New FieldLikePredicate(AllFilesFields.ClientReference, "%" & SearchText & "%"))
dbFilter.AddWithOr(New FieldLikePredicate(AllFilesFields.Cmsnumber, "%" & SearchText & "%"))
End If
For Each Filter As KeyValuePair(Of String, String) In Filters
'Custom code here to determine the field to add a filter for.
Next
dbFiles.GetMulti(dbFilter)
I have an LLBLGen Pro project which has generated VB.Net 2.0 Self Servicing code.
I have a function to return a list of custom structures based on a search using the generated code.
I would like to supply a Dictionary of FieldNames and Values to this function and for each one add a new Predicate Expression to the search.
How can I check the String within the dictionary that represents the Field name and work out which EntityField to add the Predciate Expression for?
Code Sample
Dim dbFiles As New AllFilesCollection
Dim dbFilter As New PredicateExpression
If Not String.IsNullOrEmpty(ClientName) Then
dbFilter.Add(New PredicateExpression(AllFilesFields.ClientMenuName = ClientName))
End If
If Not String.IsNullOrEmpty(SearchText) Then
dbFilter.Add(New FieldLikePredicate(AllFilesFields.ClientReference, "%" & SearchText & "%"))
dbFilter.AddWithOr(New FieldLikePredicate(AllFilesFields.Cmsnumber, "%" & SearchText & "%"))
End If
For Each Filter As KeyValuePair(Of String, String) In Filters
'Custom code here to determine the field to add a filter for.
Next
dbFiles.GetMulti(dbFilter)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这个问题已被忽略,因为它看起来像 LLBLGEN 问题,但可能不是。
如果您知道所有列:
然后您只需将字符串转换为这样的值...
I think that this question has been ignored because it looks like an LLBLGEN question, but it probably isn't.
If you know all of your Columns:
Then you just need to convert your string to those values like this...
你也可以这样做:
You also could do something like this: