Unable to use methods from Domain Service class in WCF Ria?


I am trying to build an silverlight application which takes user first name, last name, pass, email address in text boxes and then add these to the database.

For this i am using WCF Ria Services.

Steps i have followed are :

Added ADO.NET Entity Data Model and then Domain Service class in my project (in web part).

Now i have got some predefined methods in my DomainService Class like Insert, Update methods. I know how to show data in DataGrid but its not what i want.

What i want is to customize all this for :

<strong>When user clicks the submit button then there should be method inside this like AddInfo(all parameters) which can add all the data to my sql server database {at present LocalHost}.</strong>

In simple words <em>accessing your database through custom methods to add data in sql server using WCF Ria Services</em>

I know it was very simple while working in .net forms and all. But how about Silverlight & WCF ria ?

Please Suggest.



In simple words accessing your database through custom methods to add data in sql server using WCF Ria Services


What you should do is write a custom method in server-side.

On server-side, you have a DomainService class that should inherit from <a href="http://msdn.microsoft.com/en-us/library/ff423019%28v=vs.91%29.aspx" rel="nofollow">LinqToEntitiesDomainService<TContext></a>.

Simply add a method in this class with the Invoke attribute, for example:

[Invoke] public void AddNewUser(string name, string firstName, int age) { // Put logic here to add the user to the DB }

The logic to add a user to the database is really simple, just create a new Entity, add it to the context and call context.SubmitChanges();

When you compile the client RIA Services project, the auto-generated proxy class that correspond to your DomainService will contain your new method, and you'll be able to call it using:

yourDomainContext ctx = new yourDomainContext(); ctx.AddNewUser("dsd", "ds", 42).Completed += (sender, e) => { // Called asynchronously when the job is done };


If you already have the Insert method on your Domain Service, you should be able to call from the client:

//add your new data to the context MyDomainServiceContext.Entity.Add(myEntity); //(where "Entity" is your entity Type) //send all the changes to the server MyDomainServiceContext.SubmitChanges();


  • Bind customObject to DataGrid
  • Is DataGrid an alternative for UWP?
  • Pathogen ignoring ftplugin scripts
  • Quote original message in a reply using mailkit
  • Programmatically setting the record pointer in a C# DataGridView
  • Customize google placepicker colors for android
  • Visual Studio 2017 ASP.Net Publish Self-Contained Dot Net Core App
  • Resizing ToolStripButtons to fit complete BackGround image
  • How to prompt user that edits have been made upon changing pages or sorting in Kendo Grid
  • nodeJS util.format passing an array
  • JQM (jQueryMobile) Problem with AJAX content and focus()
  • Positioning children objects in scene (car wheels hierarchy)
  • Entity Framework ObjectContext: Concurrency
  • Using MouseListener to select a range of cells in a grid
  • Dart - Isolate Cross Window Communication
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • Button click event not firing in jQuery
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • JSON response opens as a file, but I can't access it with JavaScript
  • What is Eclipse's Declaration View used for?
  • req.body is undefined - nodejs
  • swift auto completion not working in Xcode6-Beta
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Sending data from AppleScript to FileMaker records
  • Jquery - Jquery Wysiwyg return html as a string
  • SVN: Merging two branches together
  • Cannot Parse HTML Data Using Android / JSOUP
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • KeystoneJS: Relationships in Admin UI not updating
  • AngularJs get employee from factory
  • Load html files in TinyMce
  • C# - Getting references of reference
  • Understanding cpu registers
  • embed rChart in Markdown
  • Add sale price programmatically to product variations
  • Append folder name and increment by 1 using batch script
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app