Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Is there TryParseLambda #141

Closed
MaklaCof opened this issue Jan 26, 2018 · 2 comments
Closed

Question: Is there TryParseLambda #141

MaklaCof opened this issue Jan 26, 2018 · 2 comments

Comments

@MaklaCof
Copy link

MaklaCof commented Jan 26, 2018

Hi,
I am storing entity properties (Grid columns) to database (together with width, sort, filter ...). When I get expression from database, I am trying to get actually Entity property, so I can get type, and other additional attributes required for application to work.
Problem is when entity property is removed or renamed I get error :

'No property or field 'PriceType' exists in type 'DbParameter''

in code:

var property = DynamicExpressionParser.ParseLambda(entityType, null, c); //c = PriceType which was removed.

I downloaded source code and search for method TryParseLambda which would return boolean and LambdaExpression as out parameter, but I couldn't found it.

How can I check if expression is valid, before calling DynamicExpressionParser.ParseLambda?

@StefH
Copy link
Collaborator

StefH commented Jan 29, 2018

You can use a try catch construction, I think that's the only thing what you can do.
IF I had to create a TryParseLambda method, that would be the same I guess.

@MaklaCof
Copy link
Author

MaklaCof commented Feb 5, 2018

Ok, thank you.
I was trying to avoid exceptions.

@MaklaCof MaklaCof closed this as completed Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants