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

Does Option work with Entity Framework? #7

Open
ghost opened this issue Mar 7, 2015 · 6 comments
Open

Does Option work with Entity Framework? #7

ghost opened this issue Mar 7, 2015 · 6 comments

Comments

@ghost
Copy link

ghost commented Mar 7, 2015

Not sure if issues is the right place to ask a question. Please do tell me if that's not the case.
I just wanted to know if "Option" works with LINQ for Entity Framework.

@louthy
Copy link
Owner

louthy commented Mar 9, 2015

Hi @zyx3nzh7

I haven't tried. Have you tried and are experiencing problems?

@ghost
Copy link
Author

ghost commented Mar 10, 2015

No, but I can try and report back on Thursday.

@ghost
Copy link
Author

ghost commented Mar 11, 2015

I tried and it doesn't work since LINQ to Entity only supports some (primitive?) types like (Int32, String, int? and Guid) and Nullable. Maybe a few more but for Option an Exception is thrown at runtime. Unfortunately this makes this great library less useful for me.

@louthy
Copy link
Owner

louthy commented Mar 12, 2015

Where do you wish to use the Option value? In the query expression or the select projection? (or both?)

@louthy
Copy link
Owner

louthy commented Mar 12, 2015

Actually, if you can post an example query that'd help. I'm wondering how you're using the value? Perhaps there's some cunning that can be done by projecting to IEnumerable and doing an 'in'.

@ghost
Copy link
Author

ghost commented Mar 12, 2015

//relevant part in the model
[Column("age")]
public Option oAge { get; set; }
//the code
var db = new testContext();
var temp = db.TestTabelle.Where(x => x.oAge == null).

Entity Framework tries to translates the lamda function to SQL at runtime and fails. Unfortunately i have no clue how the translation works internally and how one could extend it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant