This is a migrated thread and some comments may be shown as answers.

The specified entity is not contained in this EntitySet

15 Answers 244 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shanmuga
Top achievements
Rank 1
Shanmuga asked on 26 Aug 2015, 08:32 AM

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.​​

15 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 28 Aug 2015, 05:35 AM
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
0
Shanmuga
Top achievements
Rank 1
answered on 28 Aug 2015, 08:29 AM

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

0
Dimitrina
Telerik team
answered on 28 Aug 2015, 10:37 AM
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
0
Shanmuga
Top achievements
Rank 1
answered on 28 Aug 2015, 01:31 PM
Yes it contains Cell c.
0
Shanmuga
Top achievements
Rank 1
answered on 28 Aug 2015, 02:21 PM

Hi Dimitrina

Yes, context.Cells contains Cell c

0
Dimitrina
Telerik team
answered on 31 Aug 2015, 01:37 PM
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
0
Shanmuga
Top achievements
Rank 1
answered on 07 Sep 2015, 06:28 AM

Hi Dimitrina,

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

 ​

0
Stefan
Telerik team
answered on 07 Sep 2015, 01:42 PM
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
0
Shanmuga
Top achievements
Rank 1
answered on 08 Sep 2015, 10:58 AM

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​

0
Shanmuga
Top achievements
Rank 1
answered on 08 Sep 2015, 11:21 AM

Hi Stefan,

Also use this link to download new sample service project.

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

0
Stefan
Telerik team
answered on 11 Sep 2015, 10:36 AM
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
0
Shanmuga
Top achievements
Rank 1
answered on 11 Sep 2015, 01:24 PM

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?

0
Stefan
Telerik team
answered on 16 Sep 2015, 10:38 AM
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
0
Shanmuga
Top achievements
Rank 1
answered on 21 Sep 2015, 01:19 PM

Hi Stefan

Thank you very much.

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

0
Stefan
Telerik team
answered on 24 Sep 2015, 11:36 AM
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
Tags
General Discussions
Asked by
Shanmuga
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Shanmuga
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or