Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:01:09+00:00 2026-06-07T18:01:09+00:00

I am using RIA Services with Entity Framework in Silverlight 5. i have a

  • 0

I am using RIA Services with Entity Framework in Silverlight 5. i have a following Foo table;

Fooid
FooName
FooCode
FooRef

Fooid is an auto-increment number – works like a charm on save …
FooName is set in ViewModel – works fine on save …
FooCode is a 3 letter code e.g. GRN, SIP, XYZ … this is also set in the ViewModel .. no problem
FooRef is an incrementing integer. e.g. last saved value on server is 100, now the next save should be 101.

i am a bit confused as how to get this latest number. i researched a bit and i found out two ways but i am confused using these and needs help how to implement.

First Method
from ViewModel, i can call an INVOKE from RIA Service, which can provide me the last saved FooRef int. i can add it by 1 and pass the value on SubmitChanges.
Problem with First Method : The problem i face with this method is, lets say there are 3 users at their workstations at different locations. they all start creating a new Foo, when they call invoke method, they all will be given the same value which kind of breaks the whole concept down.

Second Method
I somehow intercept the Add method on server, may be via Repository, and get the value of FooRef just before Adding this entity and submitting changes.

Onyone can help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:01:12+00:00Added an answer on June 7, 2026 at 6:01 pm

    At the end, i just went on with Invoke method, and in the invoke callback function, i end up submitting the context to server.

    context.GetAssignedFooRef((op =>
            {
              entityNewFoo.FooRef = op.Value; // assign return int to FooRef
    
              context.Foo.Add(entityNewFoo);
              context.SubmitChanges();
             }
    

    This is how i tackle my problem, i dont know if it is an ideal solution or even close to it, but it works with me. The only problem i face is that, if there is another user seeking a FooRef from invoke before the first one saved. This is where Validation kicks in, and there i am going to request a new FooRef if there exists a same FooRef in the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight 3 app using WCF RIA Services and Entity Framework for
I have been experimenting recently with Silverlight, RIA Services, and Entity Framework using .NET
I am using RIA services with Entity Framework- I have the following sql select
I am using RIA Services with Silverlight and Entity Framework. I want to call
I am using Entity Framework 4.0, RIA Services, and Silverlight 4.0. I need the
We are writing a WPF application using Entity framework (Silverlight with RIA services to
I have combined RIA Services with Entity Framework using POCO's. It's all worked wonderfully
I am using SL 4, WCF RIA Services against Entity Framework 4.0. I have
I am creating a Silverlight 4 application with Entity Framework, RIA Services and MVVM-Light
I am using SL4, MVVM Toolkit, Entity Framework 4 & WCF RIA Services. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.