Devart.Data.PostgreSql.PgSqlCommand InvalidCastException

Devart.Data.PostgreSql.PgSqlCommand InvalidCastException

Postby drichter » Tue 22 Sep 2009 09:36

When executing a query like this:


Code: Select all
// Store is a linq-entity
Store store = db.Stores.SingleOrDefault(s => s.Fk_user.Equals(userid));


iam receiving ( never had this before ) a:

The object of type "Devart.Data.PostgreSql.PgSqlCommand" cannot be casted to "Devart.Data.PostgreSql.PgSqlCommand".

Stacktrace:

Code: Select all
[InvalidCastException: Das Objekt des Typs "Devart.Data.PostgreSql.PgSqlCommand" kann nicht in Typ "Devart.Data.PostgreSql.PgSqlCommand" umgewandelt werden.]
   Devart.Data.PostgreSql.Linq.Provider.PgSqlDataProvider.CreateCommand(String commandText, IDbConnection connection) +100
   Devart.Data.Linq.Provider.DataProvider.a(c A_0, f A_1, Object[] A_2, Object[] A_3, Object A_4) +269
   Devart.Data.Linq.Provider.DataProvider.a(c A_0, Object[] A_1) +137
   Devart.Data.Linq.Provider.DataProvider.h(Expression A_0) +191
   Devart.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute(Expression expression) +53
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source, Expression`1 predicate) +301
   Common.DB.StoreModel.GetStore(String userid) in C:\Projects\Common\Common\DB\StoreModel.cs:84
   WebApp.Models.CommonWebMethods.SetSessionStoreInfos(HttpSessionStateBase session) in C:\Projects\WebApp\Models\CommonWebMethods.cs:85
   WebApp.Models.CommonWebMethods.CreateSessionInitials(HttpSessionStateBase session, String userName) in C:\Projects\WebApp\Models\CommonWebMethods.cs:78
   WebApp.Controllers.AccountController.Register(String firstName, String lastName, String email, String emailConfirm, String password, String confirmPassword, String usertype, String accesscode, String captcha) in C:\Projects\WebApp\Controllers\AccountController.cs:197
   lambda_method(ExecutionScope , ControllerBase , Object[] ) +667
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
   System.Web.Mvc.<>c__DisplayClassa.b__7() +52
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +254
   System.Web.Mvc.<>c__DisplayClassc.b__9() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399
   System.Web.Mvc.Controller.ExecuteCore() +126
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
   System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Any ideas?

Thanks.
drichter
 
Posts: 20
Joined: Fri 21 Aug 2009 14:44

Postby AndreyR » Tue 22 Sep 2009 12:03

The problem looks like you have loaded two assemblies with coinciding types.
Please check your Modules window in Debug mode for duplicate assemblies.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby drichter » Tue 22 Sep 2009 13:40

Ähm, how would i do that?
drichter
 
Posts: 20
Joined: Fri 21 Aug 2009 14:44

Postby AndreyR » Tue 22 Sep 2009 13:51

When you get the mentioned exception, go to Debug->Windows->Modules.
There you will find the full list of loaded assemblies. Please check that there are no duplicate names.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for PostgreSQL