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

QDSCV Adding multiple items

2 Answers 29 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 27 Nov 2011, 05:26 PM
Hi,

I am using QDSCV in my code-behind to manage my data. In the containing class I wrote a method, that is called multiple times and uses AddNew(object) method, to add new items to the collection. When I add only one element it submits properly afterwards. But as soon as I add two or more elements the collection gets into submit mode and does not return. There is no exception but when I close and reopen the program I see that the changes have not been submitted.

This is the executed code (first AddSubscription is executed and afterwards I call SubmitSubscriptions):

public void AddSubscription(pcProject project)
{
    if(project == null)
    {
        return;
    }
 
    var subscription = (pcSubscription) subscriptions.AddNew();
    subscription.pcUser = users.CurrentItem as pcUser;
    subscription.pcProject = project;
}
public void SubmitSubscriptions()
{
    subscriptions.SubmitChanges();
}

Perhaps you can give me a clue how to get this working with more than one element at a time.

Best regards,
Peter Schmidt

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Nov 2011, 09:57 AM
Hello Peter,

Can you please send us a small sample project that demonstrates this. You can use a sampe DB such as Northwind or AdventureWorks for the purpose of demonstration.

Once we have a runnable project that we can debug, we will be able to see what is going on.

Thanks in advance.

Best wishes,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 28 Nov 2011, 10:52 AM
Hi Ross,

I tried some different things today and found out that there are multiple items with ID 0 added. This might have caused the problem with my datamodel. The strange thing is that there was no error at all. The application just stopped changing the database. As pcSubscription is a reference to a different entity I added it to the user itself instead of the subscriptions source. Now it is working fine. Sorry for the inconvenience.

Best wishes,
Peter
Tags
DomainDataSource
Asked by
Peter
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or