Click here to Skip to main content
15,902,032 members

Comments by Alex-1978 (Top 4 by date)

Alex-1978 27-Jul-18 5:00am View    
Thanks for your comment! It gave me a very important tip.

It was just necessary to add replacement of 'x' parameter in the body of roleActionBody.
I had only made replacement in the parameters of that expression.

I'm a newbie in expression tree, so it was not obvious for me :)

Thanks a lot!
Alex-1978 26-Jul-18 3:44am View    
Yeah, this is what I'm trying to do in run-time using Expression class.
I'm creating expressions for each step:

Expression<Func<Action, bool>> expr1 = z => !x.IsActive || z.IsActive;
Expression<Func<Role, IEnumerable<action>>> expr2 = y => y.Actions.Where(...)
Expression<Func<Widget, IEnumerable<action>>> expr3 => x => x.Roles ...

but this code is not written directly in C#, it is being created on the fly and the issue is that parameter 'x' from expr3 is not bound to the context of call of expr1.
I'm using ExpressionVisitor to replace parameters in the final expression, but since expr1 is not accepting 'x' as a parameter, it doesn't have access to it.

The question really is, which mechanism must be used to pass 'x' into expr1 ?
Is it a closure ? If yes, is it possible to create a clouse for a node in the expression tree ?
I've found no information about it till now.
Alex-1978 25-Jul-18 15:37pm View    
Thanks for your comment.
Could you please clarify, which nested loops are you talking about ?
Alex-1978 24-May-12 10:35am View    
I've found out a part of a solution for this problem: I've overridden GetWebRequest() method of the web-client and implemented adding of 'Accept-Encoding' header, so now I can see 'Accept-Enconding: gzip, deflate' is sent to the server, but the answer is still not compressed.
Looks like the web-service needs to be configured in a way to support this.
I saw an advice to add the following section into web.config:

<pre lang="xml"><system.webServer>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
<dynamicTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="text/xml" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="text/xml" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
</system.webServer></pre>

but it didn't help me.

Can anybody say what it is necessary to do ?