Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7648865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:49:26+00:00 2026-05-31T10:49:26+00:00

I’ve a simple class like this: Public Class CalculationParameter{ public Long TariffId{get;set;} } In

  • 0

enter image description hereI’ve a simple class like this:

Public Class CalculationParameter{
    public Long TariffId{get;set;}
}

In a workflow activity, I’ve an Assign like this:

(From tariffDetail In db.Context.TariffDetails
Where tariffDetial.TariffId = calculationParameter.TariffId).FirstOrDefault()

Dto is passed to Activity as an Input Argument.

It raise following error and I’m wondering how to assign Id. Any Idea?

LINQ to Entities does not recognize the method ‘Int64
GetValue[Int64](System.Activities.LocationReference)’ method, and this
method cannot be translated into a store expression.

How can I assign the calculationParameter.TariffId to tariffDetial.TariffId?!

UPDATE:
Screen shot attached shows that how I’m trying to assign calculationParameter.TariffId to tariffDetail.TariffId (car.Id = Dto.Id) and the query result should assign to CurrentTrafficDetail object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:49:27+00:00Added an answer on May 31, 2026 at 10:49 am

    Here’s your problem. I don’t know if there is a solution to it.

    As you said in a (now deleted, unfortunately necessitating that I answer) comment, the exception you’re getting is

    LINQ to Entities does not recognize the method Int64 GetValue[Int64](System.Activities.LocationReference) method, and this method cannot be translated into a store expression.

    in your Linq query, calculationParameter is a Variable defined on the workflow. That Variable is actually an instance that extends the type System.Activities.LocationReference and NOT CalculationParameter.

    Normally, when the workflow executes, the LocationReference holds all the information it needs to find the value which is assigned to it. That value isn’t retrieved until the last possible moment. At runtime, the process of retrieval (getting the executing context, getting the value, converting it to the expected type) is managed by the workflow.

    However, when you introduce Linq into the mix, we have the issue you are experiencing. As you may or may not know, your expression gets compiled into the extension method version of the same.

    (From tariffDetail In db.Context.TariffDetails  
    Where tariffDetial.TariffId = calculationParameter.TariffId)
    .FirstOrDefault()
    

    is compiled to

    db.Context.TariffDetails
              .Where(x => x.TariffId = calculationParameter.TariffId)
              .FirstOrDefault();
    

    When this executes, L2E doesn’t actually execute this code. It gets interpreted and converted into a SQL query which is executed against the database.

    As the interpreter isn’t omniscient, there are a well defined set of limitations on what methods you can use in a L2S query.

    Unfortunately for you, getting the current value of a LocationReference is not one of them.

    TL:DR You cannot do this.

    As for workarounds, the only thing I think you can do is create a series of extension methods on your data context type or add methods to your CalculationParameter class that you can call from within the Expression Editor. You can create your Linq to Entities queries within these methods, as all types will already have been dereferenced by the workflow runtime, which means you won’t have to worry about the L2E interpreter choking on LocationReferences.

    *Edit: A workaround can be found here (thanks to Slauma who mentioned this in a comment on the question)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.