Re: Evaluate constant parts of expressions in Linq
- From: "Andrus" <kobruleht2@xxxxxx>
- Date: Mon, 4 Feb 2008 11:33:45 +0200
I think the best answer is: if you want it to have a string, give it a
string.
I'm guessing that your actual code does something more dynamic
(otherwise the question is mute) - in which case, simply evaluate this
first.
I have column MyCharColumn of type CHAR (single character) in database.
More presice sample:
char MyCharValue = 'X';
var q = from p in db.Products
where p.MyCharColumn == MyCharValue
select p;
var l = q.ToList();
Causes compile error.
Is this DLinq defect? It does not allow compare char column with char value
!?
To fix compile error I changed query to
var q = from p in db.Products
where p.MyCharColumn == MyCharValue.ToString()
select p;
var l = q.ToList();
but this causes runtime error in DbLinq that ToString() is not supported.
How to fix without using temporary string variable ?
How to pre-process expression tree before sql generation ?
Andrus.
.
- Follow-Ups:
- Re: Evaluate constant parts of expressions in Linq
- From: Marc Gravell
- Re: Evaluate constant parts of expressions in Linq
- From: Marc Gravell
- Re: Evaluate constant parts of expressions in Linq
- From: Jon Skeet [C# MVP]
- Re: Evaluate constant parts of expressions in Linq
- References:
- Evaluate constant parts of expressions in Linq
- From: Andrus
- Re: Evaluate constant parts of expressions in Linq
- From: Marc Gravell
- Evaluate constant parts of expressions in Linq
- Prev by Date: Re: Dependency Injection - Can It Be This Simple?
- Next by Date: Confused
- Previous by thread: Re: Evaluate constant parts of expressions in Linq
- Next by thread: Re: Evaluate constant parts of expressions in Linq
- Index(es):
Relevant Pages
|