Folks, is anyone here using the EF4 in anger? I've been studying Julia
Lerman's O'Reilly book Entity Framework for weeks, and jeez it's a lot to
digest. Sometimes I'll read a chapter and think it all makes sense, then
find when I sit down to code that I have to go back and read it again, then
I usually have to go back to the chapter that introduces that chapter. I
think it will take months to get EF4 in perspective. There are lots of
classes, layers and tricks, and it's easy to get them mixed up and lose
sight of the big picture of how it all hangs together.

 

I'm playing with ObjectQuery and I'm having trouble with null parameters. In
the Entity SQL I want to have a condition in a WHERE clause like this:

 

WHERE ((@paramval IS NULL) OR (foo.Something = @paramval))

 

This is a typical piece of a WHERE clause where you want to filter on a
parameter value only if it's specified. In T-SQL for SQL Sever and CE this
is works okay. In Entity SQL I have found that I can't pass null or
DBNull.Value as the @paramval parameter value. Nor can I omit the parameter
if it's null.

 

I need to build a huge Entity SQL WHERE clause with multiple conditions like
the one above and it doesn't seem possible so far. Has anyone dabbled in
this?

 

Greg

 

 

Reply via email to