The specified entity is not contained in this EntitySet

16 posts, 0 answers
  1. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 26 Aug 2015 Link to this post

    Hi

    var results = context.Infos.Where((Infos i) => loadOperation.Entities.Contains(i)).ToList();

    results.ForEach((Infos i) => context.Infos.Detach(i));

    i got below error when add new item in gird(telerik grid row).

    "The specified entity is not contained in this EntitySet" in below line

    results.ForEach((Infos i) => context.Infos.Detach(i));

    Got this error after upgrade Silverlight Telerik controls 4.0 to
    Silverlight Telerik controls 5.0

    Before Upgrade Its working fine.

    Pls Help Me.​​

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 Aug 2015 Link to this post

    Hi,

    Generally, RadGridView will allow the operations supported by the source collection itself. Are you able to add a new item in the bound ItemsSource collection? Is this operation successful?

    You can also refer to the online documentation.

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 28 Aug 2015 in reply to Dimitrina Link to this post

    Hi

    Yes. I am able to add new item.Operation is success. But i got this error.
    "The specified entity is not contained in this EntitySet"

    See below Stack Trace

      at System.ServiceModel.DomainServices.Client.EntitySet.Remove(Entity entity)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.Remove(TEntity entity)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.ListCollectionViewProxy`1.Remove(Object value)
       at Telerik.Windows.Data.QueryableCollectionView.RemoveItemFromSourceList(IList list, Object removedItem)
       at Telerik.Windows.Data.QueryableCollectionView.RemoveItemFromSource(Object removedItem)
       at Telerik.Windows.Data.QueryableCollectionView.Remove(Object item)
       at Telerik.Windows.Data.QueryableCollectionView.CancelNew()
       at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
       at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(EffectiveNotifyCollectionChangedAction action, Object oldItem, Object newItem, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
       at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
       at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
       at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.ListCollectionViewProxy`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.ListCollectionViewProxy`1.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.ListCollectionViewProxy`1.System.ServiceModel.DomainServices.Client.ICollectionChangedListener.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.ServiceModel.DomainServices.Client.WeakCollectionChangedListener.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.ServiceModel.DomainServices.Client.EntitySet.OnCollectionChanged(NotifyCollectionChangedAction action, Object affectedObject, Int32 index)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.OnCollectionChanged(NotifyCollectionChangedAction action, Object affectedObject, Int32 index)
       at System.ServiceModel.DomainServices.Client.EntitySet.Detach(Entity entity)
       at System.ServiceModel.DomainServices.Client.EntitySet`1.Detach(TEntity entity)
       at ProView.ViewModels.NodeViewModel.<OnLoadCellsCompleted>b__10(Cell c)
       at System.Collections.Generic.List`1.ForEach(Action`1 action)
       at ProView.ViewModels.NodeViewModel.OnLoadCellsCompleted(LoadOperation`1 loadOperation)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
       at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
       at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
       at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
       at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
       at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )


    and see the screen shot

  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 Aug 2015 Link to this post

    Hi,

    The error message indicates there is not such an entity in the Entety Set. Would you please ensure context.Cells contains Cell c?

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 28 Aug 2015 in reply to Dimitrina Link to this post

    Yes it contains Cell c.
  7. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 28 Aug 2015 in reply to Dimitrina Link to this post

    Hi Dimitrina

    Yes, context.Cells contains Cell c

  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Aug 2015 Link to this post

    Hi,

    Have you tried with any other ItemsControl? In case it is specific issue with RadGridView handling this scenario, would it be possible for you to isolate the case in a demo project and send it to us in a new support ticket? You can also take a look at this blog post for a reference on how to isolate an issue. 

    That way we will check the specific scenario and advice further.


    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 07 Sep 2015 in reply to Dimitrina Link to this post

    Hi Dimitrina,

    Download sample project using following link.
    http://jmp.sh/I5mh9Ka

     ​

  10. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 07 Sep 2015 Link to this post

    Hi Shanmuga,

    Thanks for the sample project.

    Generally, such exception is thrown when an entity is not contained within the entity set. Note, that in order two objects to be equal, they need to point to the same memory location. You can take a look at the Exception “The specified entity is not contained in this EntitySet.” but Entity is contained and Getting The specified entity is not contained in this EntitySet error StackOverflow threads for further reference.

    As to your specific scenario, can you please share some details on how are you reproducing the error, as with the current implementation the "else" statement in the following code is never executed?
    private void OnLoadCellsCompleted(LoadOperation<Cell> loadOperation)
    {
     
        if (loadOperation.HasError)
        {
            if (!this.isSessionExpired(loadOperation))
            {
                MessageBox.Show(loadOperation.Error.Message);
                loadOperation.MarkErrorAsHandled();
            }
            IsBusy = false;
        }
        else
        {
            var results = context.Cells.Where((Cell c) => !loadOperation.Entities.Contains(c)).ToList();
            results.ForEach((Cell c) => context.Cells.Detach(c));
            Cells = context.Cells;
            IsBusy = false;
            if (Cells.Count > 0)
            {
                SelectedCell = Cells.First();
            }
        }
    }

    You can take a look at the following video as a demonstration: link.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  11. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 08 Sep 2015 in reply to Stefan X1 Link to this post

    Hi Stefan,

    Sorry, In last post I missed App_Data folder.

    Please Download New Sample project using following links.

    http://jmp.sh/qQGNh1H​

    https://jumpshare.com/b/putQkaZVGJTRsWubfsIF​

  12. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 08 Sep 2015 in reply to Stefan X1 Link to this post

    Hi Stefan,

    Also use this link to download new sample service project.

    https://rapidshare.cc/getfile/code/b329b1224c7cc8f1a3544cc1407874ae

  13. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 11 Sep 2015 Link to this post

    Hi Shanmuga,

    Thanks for the modified project.

    I suggest you taking a look at the Getting the specified entity is not contained in this EntitySet as well at the ERROR: SystemInvalidOperationException: The specified entity is not contained in this EntitySet topics, as there are couple of possible resolutions for this issue discussed in them.

    Hope this helps.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  14. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 11 Sep 2015 in reply to Stefan X1 Link to this post

    Hi Stefan,

    Thanks for your replying.

    I have one doubt,

    In same project is working fine below version

    Silverlight Version - 4 and 5
    DLL Name - Telerik.Windows.Controls.GridView,
    (Telerik Control Version)
    Runtime Version - v2.0.50727,
    DLL Version - 2011.3.1220.1040


    But i got this issue (The specified entity is not contained in this EntitySet) after Upgrade below version only

    Silverlight Version - 5
    DLL Name - Telerik.Windows.Controls.GridView
    (Telerik Control Version) UI for Silverlight Q1 2015
    Runtime Version - v4.0.30319,
    DLL Version - 2015.1.401.1050


    Any Idea? Any assembly reference is missing?

  15. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 16 Sep 2015 Link to this post

    Hello Shanmuga,

    I tested the application with 2011.3.1220.1040 assemblies version targeting Silverlight 4 and 5 and it seems that the issue is reproducible as well. The entity cannot be found in the EntitySet. The only difference is that an exception is not raised, thus the Cells collection is being set to null. You can take a look at the following video as a demonstration: link.

    Regards,
    Stefan X1
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  16. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 21 Sep 2015 in reply to Stefan X1 Link to this post

    Hi Stefan

    Thank you very much.

    Please test the application with 2015.1.401.1050 assemblies version targeting silverlight 5.

  17. Stefan X1
    Admin
    Stefan X1 avatar
    518 posts

    Posted 24 Sep 2015 Link to this post

    Hello Shanmuga,

    I tested the application with 2015.1.401.1050 version targeting Silverlight 5 and the issue was reproduced as well. The difference from 2011.3.1220.1040 version is that an exception is raised. Please note, that a malfunction that does not raise an exception is the worse scenario.

    For a possible resolution, you can refer to the StackOverflow forum threads I suggested in one of my previous posts.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner