Unable to query any entity collections

4 posts, 0 answers
  1. Ken
    Ken avatar
    2 posts
    Member since:
    Aug 2012

    Posted 26 Aug 2012 Link to this post

    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!
  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 27 Aug 2012 Link to this post

    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
    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!
  3. DevCraft banner
  4. Ken
    Ken avatar
    2 posts
    Member since:
    Aug 2012

    Posted 28 Aug 2012 Link to this post

    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
  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 29 Aug 2012 Link to this post

    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
    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!
Back to Top