本文介绍了如何在EntityFramework中创建“234%4”或%2324%335%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都知道如何做这个查询?我知道我可以开始和EndWith,但是我必须解析字符串,我可以有%2324%335%现在?解决方案
您可以:
< Function Name =String_LikeReturnType =Edm.Boolean>
< Parameter Name =searchingInType =Edm.String/>
< Parameter Name =lookingForType =Edm.String/>
< DefiningExpression>
searchingIn LIKE lookingFor
< / DefiningExpression>
< / Function>
使用
[System.Data.Objects.DataClasses.EdmFunction(Your.Namespace,String_Like)]
public static Boolean Like(this String searchingIn,String lookingFor){
抛出新异常(未实现);
}
Anyone know how to do this query? I know I can usar a start with and EndWith, but I have to parse the string and I can have %2324%335% and now? Any way to do this easy?
解决方案
You can create a custom function:
<Function Name="String_Like" ReturnType="Edm.Boolean">
<Parameter Name="searchingIn" Type="Edm.String" />
<Parameter Name="lookingFor" Type="Edm.String" />
<DefiningExpression>
searchingIn LIKE lookingFor
</DefiningExpression>
</Function>
And call it using
[System.Data.Objects.DataClasses.EdmFunction( "Your.Namespace", "String_Like")]
public static Boolean Like(this String searchingIn, String lookingFor) {
throw new Exception("Not implemented");
}
这篇关于如何在EntityFramework中创建“234%4”或%2324%335%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!