Results 1 to 4 of 4

Thread: ExpressionEvaluator problem

  1. #1
    Join Date
    May 2006
    Location
    Russia
    Posts
    28

    Default ExpressionEvaluator problem

    Hi all!
    I have problem with usage Spring.Expressions.ExpressionEvaluator.
    When I used Preview 2, my code looks like:

    object result = ExpressionEvaluator.GetValue(null, "@Audit.LogInfo(#v0, #v1)" , vars);

    At present time with usage Preview 3 this code generates exception "unexpected token: [\"@\",<34>,line=1,col=1]"

    "Audit" is bean's name.
    What do I do wrong?
    Last edited by zerg78; 01-30-2007 at 10:34 AM.

  2. #2
    Join Date
    May 2006
    Location
    Russia
    Posts
    28

    Default

    I have resolved my first problem. I have excluded "@" from my expression, but I have new problem:
    After call:

    object result = ExpressionEvaluator.GetValue(null, "Audit.LogInfo(#v0, #v1)" , vars);

    I have exception "Cannot initialize property or field node because its context is null."

    I have question: Why ExpressEvaluator doesn't search "Audit" among context beans, but does it only among internal and extermal assemblies types?

    Calling of method ExpressionEvaluator.GetValue(applicationContext["Audit"], "LogInfo('a','b')") works fine.
    In my case I can't use applicationContext directly.
    What I need to do?

  3. #3
    Join Date
    Oct 2005
    Location
    Toulouse, France
    Posts
    1,407

    Default

    Hi,

    We introduced new functionalities to the Expression Language with 1.1 P3, and the syntax to reference a Spring object/bean has changed.
    See BreakingChanges-1.1.txt file.

    This should work :
    Code:
    object result = ExpressionEvaluator.GetValue(null, "@(Audit).LogInfo(#v0, #v1)" , vars);
    The Spring.NET 1.1 Preview 3 documentation has also been updated.
    Spring Object References


    Sorry for the inconvenience,
    Bruno
    Last edited by Bruno Baia; 01-30-2007 at 03:25 PM.
    My english is as poor as my taylor is rich

  4. #4
    Join Date
    May 2006
    Location
    Russia
    Posts
    28

    Default

    Hello Bruno!
    Thank you for quick response.
    I have modified my sources. Everything works fine!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •