This is the SQL I want to execute:
WHERE domain_nm + '\' + group_nm in ('DOMAINNAME\USERNAME1','DOMAINNAME2\USERNAME2')
I cannot find a suitable expression for this for me. And I donโt think I can use two expressions, because the domain name and group name should be combined.
Thank!
Can you use two expressions?
criteria .Add(Expression.In("DomainName", new string[] { "DOMAINNAME", "DOMAINNAME2" })) .Add(Expression.In("GroupName", new string[] { "USERNAME1", "USERNAME2" })
Another option is to use Expression.Sql.
Expression.Sql is as follows:
.Add(Expression.Sql(String.Format("{{alias}}.domain_nm + '\' + {{alias}}.group_nm in ({0})", getSqlInString(userGroups))))
, , .
_ , . . _ , .
. . , nhibernate
Map(x => x.FullName).Formula("[domain_nm] + '\' + [group_nm]")
Then the request will look like this:
criteria.Add(Expression.In("FullName", new string[] { "DOMAINNAME\USERNAME1", "DOMAINNAME2\USERNAME2" }))
Source: https://habr.com/ru/post/1698156/More articles:How can I access the "displayed" text of the window selection option from the DOM? - javascriptHow can I use array references inside arrays in PHP? - arraysIs validation called before or after enforcement when setting DependencyProperty? - wpfLIKE in Linq to SQL - vb.netUsing Xdebug & Zend Debugger? - profilingConnecting to an Informix Database from .Net - c #Why can't .NET parse a date string with a timezone? - datetimeIs it possible to set a default value when deserializing xml in C # (.NET 3.5)? - c #Debugging: runtime break on file change? (windows) - debuggingWhat will be the pNext pointer in the following case using C? - cAll Articles