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

[Solved] Not a Promising Start !!

6 Answers 177 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ubuntu
Top achievements
Rank 1
Ubuntu asked on 05 Apr 2011, 06:39 PM
Dear Everyone,

I am now 2 days struggling to get the OA working instead of my previous Microsoft EF-4.

I created a sample project structure Client and server(.web) then I created a RIA service project (2 projects, client & server), then i setup the reference between the Client & Server projects.

I then added the OA DataModel and then OA DomainService.

I add the Data Access code in one of my SL client applications that need access to the Database, I found that I can reference the DomainContext class not the DomainService class, How can I access the DomainService here?

I start dealing with the DomainContext, I try change one of the entities and call the SubmitChanges() on the DomainContext I added the Try/catch as follows:
if (Context.HasChanges == false) return false;
try
{
    Context.SubmitChanges();
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
    return false;
}
  
return true;

it doesn't catch anything but IE through this error:
Webpage error details
  
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Tue, 5 Apr 2011 17:34:12 UTC
  
  
Message: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.ServiceModel.DomainServices.Client.DomainOperationException: Submit operation failed due to conflicts. Please inspect Entity.EntityConflict for each entity in EntitiesInError for more information.
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.SubmitOperation.Complete(OperationErrorStatus errorStatus)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteSubmitChanges(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClassd.<SubmitChanges>b__5(Object )     
  
Line: 56
Char: 13
Code: 0
URI: http://localhost:13256/MyTestPage.aspx

Any Idea of how can I handle the exception here

I am using RIA services, SL4.

Any help ..
Greetings

6 Answers, 1 is accepted

Sort by
0
Ubuntu
Top achievements
Rank 1
answered on 07 Apr 2011, 06:43 PM
Dear All,

I have progress a little bit to trace the error doing the following:
In the my SubmitChanges() method I added a callback method as follows:
if (so.EntitiesInError.Any()) 
{
    message = string.Empty; 
    Entity entityInError = so.EntitiesInError.First(); 
    if (entityInError.EntityConflict != null)
    {
        EntityConflict conflict = entityInError.EntityConflict;
        foreach (var cm in conflict.PropertyNames)
        {
            message += string.Format("{0}", cm);
        }
    }
    else if (entityInError.ValidationErrors.Any())
    {
        message += "\r\n" + entityInError.ValidationErrors.First().ErrorMessage;
    }
}
MessageBox.Show(message, "Submit Failed", MessageBoxButton.OK);

I didn't understand what the MessageBox says "OpenAccess Version".
What is the issue; re-installation or what ...
I previously had an older version installed from a friend (trial) before I downloaded the current one.

How is it relevant to myEntities !!.

I am confused .. any explanation will be fine.
Best
0
Accepted
PetarP
Telerik team
answered on 08 Apr 2011, 03:04 PM
Hi Ubuntu,

 Can you please share with us what concurrency control strategy are you using? If you are using Version can you please  check that in your tables there is indeed a column voa_version? Maybe that is the problem. In order to see if that is the problem you can switch off the concurrency control for the failing class (set it to None) and see if that fixes your problem.

All the best,
Petar
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ubuntu
Top achievements
Rank 1
answered on 08 Apr 2011, 04:53 PM
Dear Peter,

What are the available strategies, I don't have any implemented yet .. 
Any resources(Reading/examples/ etc ...) in this area would be great .. 

I can understand what you are saying,
Yes the concurency was the problem, thank you very much...

Best

0
PetarP
Telerik team
answered on 12 Apr 2011, 03:55 PM
Hi Ubuntu,

 We are interested to know what was the problem. Was it the missing voa_version column? If it wasn't it might be possible that we have a bug on our side that we will be happy to resolve.

All the best,
Petar
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ubuntu
Top achievements
Rank 1
answered on 13 Apr 2011, 11:10 PM
Hello Peter,

I was missing voa_version ... I don't have it ...
Best
0
PetarP
Telerik team
answered on 14 Apr 2011, 01:13 PM
Hi Ubuntu,

 Great. So as you have probably found out yourself creating the voa_version or changing the concurrency mechanism should do the trick. 
Please do not hesitate to contact us should you face any further questions.

Best wishes,
Petar
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Getting Started
Asked by
Ubuntu
Top achievements
Rank 1
Answers by
Ubuntu
Top achievements
Rank 1
PetarP
Telerik team
Share this question
or