WHERE (C.CustomerID =@CustomerID or @CustomerID ISNULL
AND C.Surname =@Surname or @Surname ISNULL
AND C.Name=@Name or @Name ISNULL
AND CA.Street =@Street or @Street ISNULL
AND CA.City =@City or @City ISNULL
AND CO.OrderName =@OrderName or @OrderName ISNULL)
AND ((ModifiedDate BETWEEN ISNULL(convert(varchar,@FromDate,101),'01/01/1901')
AND ISNULL(convert(varchar,@ToDate,101),'12/31/9999'))

SELECT
[Extent1].[MFRCode] AS [MFRCode],
[Extent1].[MFRProductID] AS [MFRProductID],
[Extent1].[Universal] AS [Universal],
[Extent1].[Description] AS [Description]
FROM [dbo].[Products] AS [Extent1]
WHERE (([Extent1].[Description] LIKE N'%v%') AND ([Extent1].[Description] LIKE N'C%')) OR (N'TOYOTA' = [Extent1].[MFRCode]) OR ([Extent1].[Universal] IS NULL)

and produce these results:

Edit

I used LINQPad to generate these results. It's a great tool, free to use (there's an option to purchase an Intellisense feature), and definitely worth a look if you'd like to experiment with different LINQ queries and see the SQL that EF is generating (it's good for general LINQ experimentation and quickly trying out simple code as well).

thanks a lot for your reply.Managed to make it nearly all work.I have a problem in creating a "Like" with integer.Do I need to do something like "SqlFunctions.StringConvert((double)c.CustomerID)).Contains("12") .but the sql output is nothing like c.CustomerID LIKE '%' + @SearchText + '%' I get WHERE (STR( CAST( [Extent2].[CustomerID] AS float)) LIKE N'%1%')
–
user9969Nov 30 '10 at 16:49

@user231465, I just tried using SqlFunctions.StringConvert, and I get the correct results. The sql that EF produces in this case is not as simple as what you would code by hand. It casts to float, then to string using the STR function, then does the LIKE comparison. For some reason, there is no overload for StringConvert that takes an int, so the (double)c.CustomerID is the reason for the cast to float. Also, I assume .Contains("12") resulted in LIKE N'%12%' in your comment, not LIKE N'%1%.
–
Jeff OgataNov 30 '10 at 23:57

is there anywhere an example how to do "AND OR SYNTAX" eg " AND CA.City =@City or @City ISNULL " thanks
–
user9969Dec 1 '10 at 5:28

@user231465, you would just use the C# logical operators, && and ||. See the example in my answer and the sql that was generated in the where clause.
–
Jeff OgataDec 1 '10 at 16:37

@adrift. Thanks for your reply.but I have used the logical operators for And or but the EF did not produce the syntaxt I was expecting the "or @City is null" was missing .mmm
–
user9969Dec 2 '10 at 11:39