AttachCopy throwing NotImplementedException

Thread is closed for posting
3 posts, 0 answers
  1. Paulo
    Paulo avatar
    3 posts
    Member since:
    Nov 2013

    Posted 04 Nov 2013 Link to this post


    I'm trying to update an entity on database using the AttachCopy method, but i'm getting the following error:

       at OpenAccessRuntime.common.GenericState.UnresolveForCompare(Object x, FieldMetaData fmd, OpenAccessPersistenceManagerImp pm)
       at OpenAccessRuntime.common.GenericState.Equals(State o, Int32 stateFieldNo, OpenAccessPersistenceManagerImp myPm, OpenAccessPersistenceManagerImp otherPm)
       at Telerik.OpenAccess.Runtime.Detached.AttachOperation.FindChanges(Boolean[] filled, State detached, OpenAccessPersistenceManagerImp detachedPM, State online, Int32 ignoreCC)
       at Telerik.OpenAccess.Runtime.Detached.AttachOperation.AttachCopyImplDetached(OpenAccessPersistenceManagerImp srcPM, PersistenceCapable src)
       at Telerik.OpenAccess.Runtime.Detached.AttachOperation.AttachCopyImpl(PersistenceCapable src, Boolean copy)
       at Telerik.OpenAccess.Runtime.Detached.AttachOperation.AttachCopies()
       at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.AttachCopies(ArrayList persistentObjects)
       at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.AttachCopies(ArrayList persistentObjects)
       at OpenAccessRuntime.ObjectScope.AttachCopies(ArrayList persistentObjects)
       at Telerik.OpenAccess.OpenAccessContextBase.AttachCopy[T](T entity)
  2. Paulo
    Paulo avatar
    3 posts
    Member since:
    Nov 2013

    Posted 05 Nov 2013 Link to this post

    I'm trying to update an object using the attach copy but this not works,

    the method ToDbEntity updates the instance with values coming from the parameter object that's not the same type as telerik generates.

    public void Save( T entity )
               using ( DataContext context = new DataContext(this.connectionString) )
                       using ( TransactionScope scope = ObterTransactionScope() )
                           TDb dbEntity = ( TDb ) db.CreateInstance(typeof(TDb).FullName);
                           dbEntity = db.AttachCopy<TDb>(dbEntity);
                           this.GetFactory().ToDbEntity(entity, dbEntity);                                         
  3. Alexander
    Alexander avatar
    727 posts

    Posted 06 Nov 2013 Link to this post

    Hi Paulo,

    Please, let's continue the communication in your other thread about the same problem, so the whole information is available at one place.

    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top