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;
}
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;
}
Any updated builds would be appreciated, we're currently evaluating the connector with a view to using it for our new systems.[/code]