LINQ to Entity - can't compare string

LINQ to Entity - can't compare string

Postby Boffbowsh » Tue 05 Feb 2008 21:14

Using Build 4.30.24.0 with Visual Studio 2008, Entity Framework beta 3 etc, the following simple code fails:

Code: Select all
        public static user Authenticate(string Username, string Password)
        {
            Entities context = new Entities(ConfigurationManager.ConnectionStrings["Entities"].ConnectionString);
            user user = (from u in context.user
                         where u.Username == Username
                         where u.Password == Password
                         select u).First();
            return user;
        }


Exception is:
Test method TestProject1.UserTest.AuthenticateTest threw exception: System.Data.CommandCompilationException: An error occurred while preparing the command definition, see the inner exception for details. ---> System.InvalidCastException: Specified cast is not valid..

Trace:
CoreLab.Common.Entity.e.a(TypeUsage A_0, String A_1, Int32& A_2)
CoreLab.Common.Entity.e.a(TypeUsage A_0, Int32& A_1)
CoreLab.Common.Entity.e.a(DbParameter A_0, TypeUsage A_1)
CoreLab.Common.Entity.e.b(DbParameter A_0, TypeUsage A_1)
CoreLab.Common.Entity.l.a(DbParameter A_0, KeyValuePair`2 A_1)
CoreLab.MySql.Entity.c.a(DbCommandTree A_0, DbConnection A_1)
CoreLab.MySql.Entity.MySqlEntityProviderServices.b(DbConnection A_0, DbCommandTree A_1)
System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbConnection storeConnection, DbCommandTree commandTree)
System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbConnection storeConnection, DbCommandTree commandTree)
System.Data.EntityClient.EntityCommand.CreateCommandDefinition()
System.Data.EntityClient.EntityCommand.GetCommandDefinition()
System.Data.EntityClient.EntityCommand.Prepare()
System.Data.EntityClient.EntityProviderServices.CreateDbCommandDefinition(DbConnection connection, DbCommandTree commandTree)
CreateExecutionInfo(ObjectContext context, DbQueryCommandTree tree, SpanIndex spanInfo, MergeOption mergeOption)
CreateExecutionInfo(DbQueryCommandTree tree, MergeOption mergeOption, Span span)
CreateExecutionInfo(MergeOption mergeOption, TypeUsage& resultType)
Compile(MergeOption mergeOption)
GetExecutionInfo(MergeOption mergeOption)
GetResults(MergeOption mergeOption)
GetResults()
GetEnumerator()
System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
b__0[TResult](IEnumerable`1 sequence)
System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
System.Linq.Queryable.First[TSource](IQueryable`1 source)
Model.user.Authenticate(String Username, String Password) in C:\Users\****\Documents\Visual Studio 2008\Projects\MySQLEntityTest\MSSQLEntityTest\User.cs: line 15
TestProject1.UserTest.AuthenticateTest() in C:\Users\****\Documents\Visual Studio 2008\Projects\MySQLEntityTest\TestProject2\UserTest.cs: line 73


The same conditions (as far as possible) using MSSQL works fine. Comparing by int works fine too:

Code: Select all
        public static user GetById(int Id)
        {
            Entities context = new Entities(ConfigurationManager.ConnectionStrings["Entities"].ConnectionString);
            user user = (from u in context.user
                         where u.UserID == Id
                         select u).First();
            return user;
        }


SQL for creating DB is at http://www.boffbowsh.co.uk/testdb.sql.txt

Any updated builds would be appreciated, we're currently evaluating the connector with a view to using it for our new systems.[/code]
Boffbowsh
 
Posts: 9
Joined: Sun 03 Feb 2008 21:47

Postby Alexey.mdr » Wed 06 Feb 2008 09:31

I couldn't reproduce the error.
Please send me a small test project to reproduce the problem.
It is desirable to use 'test' schema objects, otherwise include the
definition of your own database objects.
Do not use third party components.
If it is impossible for you to create the test project, send us a piece of
your code where the error occurs.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby Boffbowsh » Wed 06 Feb 2008 10:14

http://www.boffbowsh.co.uk/MySQLEntityTest.rar
This is the most basic project I could do that produces the problem. It doesn't contain anything that wasn't in my previous post.
Boffbowsh
 
Posts: 9
Joined: Sun 03 Feb 2008 21:47

Postby Alexey.mdr » Wed 06 Feb 2008 14:40

We will try to fix this bug in the nearest time.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby Boffbowsh » Wed 06 Feb 2008 16:09

I'd be willing to test any beta builds that might fix the issue.
Boffbowsh
 
Posts: 9
Joined: Sun 03 Feb 2008 21:47

Postby Alexey.mdr » Thu 07 Feb 2008 10:00

We have an intention to issue a new build next week.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby Boffbowsh » Wed 13 Feb 2008 10:11

Any updates on when you intend to issue a new build?
Boffbowsh
 
Posts: 9
Joined: Sun 03 Feb 2008 21:47

Postby Alexey.mdr » Wed 13 Feb 2008 13:17

Currently we are testing a new build.
Probably at the end of this week we will issue it.
But unfortunately the new build won't include a fix of the bug you are interested in.
The problem appears to be more complicated than expected, resulting in a solution delay.
We are still working on the problem. At this time we can't specify when exactly the bug will be fixed.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby Boffbowsh » Wed 20 Feb 2008 10:39

Sorry to keep hassling, any update on this?
Boffbowsh
 
Posts: 9
Joined: Sun 03 Feb 2008 21:47

Postby Alexey.mdr » Wed 20 Feb 2008 13:41

Yes, we have fixed the bug.
The build will be available for download next week.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Postby Boffbowsh » Wed 20 Feb 2008 13:42

Excellent news, thanks very much :)
Boffbowsh
 
Posts: 9
Joined: Sun 03 Feb 2008 21:47

Postby Alexey.mdr » Thu 21 Feb 2008 11:57

Welcome!
Look forward to the next build.
We will make an announcement soon.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24


Return to dotConnect for MySQL