This question is locked. New answers and comments are not allowed.
Hi,
I am currently trialing OpenAccess with a model reverse-engineered from our Firebird database.
I am unable to execute any LINQ queries against this model, as I get 'Object must implement IConvertible' errors every time.
The error occurs in the get accessors of each entity collection type.
Example query:
var q = from c in ctx.Clients select c;
Any ideas as to what is causing this?
Thanks!
I am currently trialing OpenAccess with a model reverse-engineered from our Firebird database.
I am unable to execute any LINQ queries against this model, as I get 'Object must implement IConvertible' errors every time.
The error occurs in the get accessors of each entity collection type.
Example query:
var q = from c in ctx.Clients select c;
Any ideas as to what is causing this?
Thanks!
3 Answers, 1 is accepted
0
Hello Ken,
All collections that are loaded from the database are not longer List<T>. I guess you are trying to cast the property from an IList<T> to a List<T>. Because OpenAccess adds change tracking, we are replacing your List<T> with a Telerik.OpenAccess.TrackedList<T>. If you just use the IList<T> interface everything should work.
Kind regards,
Jan Blessenohl
the Telerik team
All collections that are loaded from the database are not longer List<T>. I guess you are trying to cast the property from an IList<T> to a List<T>. Because OpenAccess adds change tracking, we are replacing your List<T> with a Telerik.OpenAccess.TrackedList<T>. If you just use the IList<T> interface everything should work.
Kind regards,
Jan Blessenohl
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Ken
Top achievements
Rank 1
answered on 29 Aug 2012, 02:51 AM
Hi Jan,
Thank you for the reply but I don't think that is the problem. The error happens on attempt to access the collection, as in the sample line I posted - no casting. Here is further detail I should have included:
Message:
Object must implement IConvertible.
StackTrace:
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at OpenAccessRuntime.ExceptionWrapper.Throw()
at OpenAccessRuntime.Helper.getPersistenceManagerFactory(PropertySet props)
at OpenAccessRuntime.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open)
at OpenAccessRuntime.DatabaseAdapter.GetObjectScope(TransactionProvider provider)
at Telerik.OpenAccess.Database.GetObjectScope(TransactionProvider provider)
at Telerik.OpenAccess.OpenAccessContextBase.GetScope()
at Telerik.OpenAccess.OpenAccessContext.GetAllCore[T]()
at Telerik.OpenAccess.OpenAccessContext.GetAll[T]()
at CCare.Data.Model.Telerik.CCareModel.get_Clients() in <<SNIP>>\CCareModel.cs:line 59
at CCare.Testing.ORMappers.MainForm.buttonLoadGridFromTelerik_Click(Object sender, EventArgs e) in <<SNIP>>\MainForm.cs:line 44
------------------------
InnerException:
Message:
Object must implement IConvertible.
StackTrace:
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.executeQuery(String sql)
at OpenAccessRuntime.Relational.sql.HighLowRelationalKeyGenerator.IsCached(Connection con, RelationalKeyGeneratorInfoCache infoCache, String tab, String kCol, String vCol, String key, Boolean& ret)
at OpenAccessRuntime.Relational.sql.HighLowRelationalKeyGenerator.init(String sequenceName, Connection con, RelationalKeyGeneratorInfoCache relationalKeyGeneratorInfoCache)
at OpenAccessRuntime.Relational.sql.HighLowRelationalKeyGenerator.init(String className, RelationalTable theClassTable, Connection con, RelationalKeyGeneratorInfoCache relationalKeyGeneratorInfoCache)
at OpenAccessRuntime.Relational.RelationalStorageManagerFactory.Init(Boolean full, ModelMetaData metaData, RelationalConnectionSource conSrc, Boolean hyperdrive, SqlDriver sqlDriver)
at OpenAccessRuntime.Relational.RelationalStorageManagerFactory.init(Boolean full)
at OpenAccessRuntime.storagemanager.logging.LoggingStorageManagerFactory.init(Boolean full)
at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.createStorageManagerFactory()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryBase.init()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.init()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp..ctor(PropertySet properties, Object classloader)
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.getPersistenceManagerFactory(PropertySet props)
at OpenAccessRuntime.DataObjects.BootstrapPMF.getPersistenceManagerFactory(PropertySet props)
at OpenAccessRuntime.Helper.getPersistenceManagerFactory(PropertySet props)
Thanks,
Ken
Thank you for the reply but I don't think that is the problem. The error happens on attempt to access the collection, as in the sample line I posted - no casting. Here is further detail I should have included:
Message:
Object must implement IConvertible.
StackTrace:
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at OpenAccessRuntime.ExceptionWrapper.Throw()
at OpenAccessRuntime.Helper.getPersistenceManagerFactory(PropertySet props)
at OpenAccessRuntime.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open)
at OpenAccessRuntime.DatabaseAdapter.GetObjectScope(TransactionProvider provider)
at Telerik.OpenAccess.Database.GetObjectScope(TransactionProvider provider)
at Telerik.OpenAccess.OpenAccessContextBase.GetScope()
at Telerik.OpenAccess.OpenAccessContext.GetAllCore[T]()
at Telerik.OpenAccess.OpenAccessContext.GetAll[T]()
at CCare.Data.Model.Telerik.CCareModel.get_Clients() in <<SNIP>>\CCareModel.cs:line 59
at CCare.Testing.ORMappers.MainForm.buttonLoadGridFromTelerik_Click(Object sender, EventArgs e) in <<SNIP>>\MainForm.cs:line 44
------------------------
InnerException:
Message:
Object must implement IConvertible.
StackTrace:
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.executeQuery(String sql)
at OpenAccessRuntime.Relational.sql.HighLowRelationalKeyGenerator.IsCached(Connection con, RelationalKeyGeneratorInfoCache infoCache, String tab, String kCol, String vCol, String key, Boolean& ret)
at OpenAccessRuntime.Relational.sql.HighLowRelationalKeyGenerator.init(String sequenceName, Connection con, RelationalKeyGeneratorInfoCache relationalKeyGeneratorInfoCache)
at OpenAccessRuntime.Relational.sql.HighLowRelationalKeyGenerator.init(String className, RelationalTable theClassTable, Connection con, RelationalKeyGeneratorInfoCache relationalKeyGeneratorInfoCache)
at OpenAccessRuntime.Relational.RelationalStorageManagerFactory.Init(Boolean full, ModelMetaData metaData, RelationalConnectionSource conSrc, Boolean hyperdrive, SqlDriver sqlDriver)
at OpenAccessRuntime.Relational.RelationalStorageManagerFactory.init(Boolean full)
at OpenAccessRuntime.storagemanager.logging.LoggingStorageManagerFactory.init(Boolean full)
at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.createStorageManagerFactory()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryBase.init()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.init()
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp..ctor(PropertySet properties, Object classloader)
at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.getPersistenceManagerFactory(PropertySet props)
at OpenAccessRuntime.DataObjects.BootstrapPMF.getPersistenceManagerFactory(PropertySet props)
at OpenAccessRuntime.Helper.getPersistenceManagerFactory(PropertySet props)
Thanks,
Ken
0
Hi Ken,
this throws some light on it, looks like a configuration problem. Because we open the database lazy if the first operation is executed, you see a database open error here.
Is it possible to send me your project? It is then very easy to fix it, otherwise I have to guess which configuration setting it is. I have morphed this thread to a support thread and you should be able to attach a zip file now.
All the best,
Jan Blessenohl
the Telerik team
this throws some light on it, looks like a configuration problem. Because we open the database lazy if the first operation is executed, you see a database open error here.
Is it possible to send me your project? It is then very easy to fix it, otherwise I have to guess which configuration setting it is. I have morphed this thread to a support thread and you should be able to attach a zip file now.
All the best,
Jan Blessenohl
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!