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

Calling ToString on a nullable column throws error #26

Closed
lennyf opened this issue Jun 15, 2016 · 0 comments
Closed

Calling ToString on a nullable column throws error #26

lennyf opened this issue Jun 15, 2016 · 0 comments

Comments

@lennyf
Copy link

lennyf commented Jun 15, 2016

When writing an entity query you can convert a nullable column to a string

myDbContext.Contact.Select(c => c.NullableIntColumn.ToString());

However this code using the dyanamic linq will not work if the column is nullable and throws a ParseException - "Methods on type 'Int32?' are not accessible"

myDbContext.Contact.Select("NullableIntColumn.ToString()");

Update - Seems you can replicate the ToString in LinqToEntity by doing a conversion to its non nullable type first and then calling to string myDbContext.Contact.Select("int(NullableIntColumn).ToString()");

@lennyf lennyf closed this as completed Jun 15, 2016
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

1 participant