Ria service learning

Source: Internet
Author: User

1. Add ADO. NET Entity model ing to a table in the WEB Project

2. Add the domainservices class and select enableedit to automatically generate insert update Delete.

3. You can write the query method in domainservices .. For example, add a where (a => A. Name = "zmj ")

4. Note that you must compile each step.

5. datacontent. Load (datacontent. getusersbyname ("zmj"); query

6 propertychanged event: propertychanged + = new system. componentmodel. propertychangedeventhandler (datacontent_propertychanged );

Public void datacontent_propertychanged (Object sender, system. componentmodel. propertychangedeventargs ARGs)

{

VaR list = from u in datacontent. Users where u. Name = "zmj" select U;

Foreach (var u in List)

{

_ Objuser = u;

}

This. label1.text = _ objuser. ID;

}

This is because the RIA service load data is asynchronous. This event is equivalent to a monitoring event. When the data changes, the operation is completed. If you still want to do the following: 1. Fetch data 2. Assign data to the UI.

Because when you do step 2, You Can Do step 1. This is the biggest headache for new contacts.

7. Update:

_ Objuser. ID = "321 ";

Datacontent. submitchanges ();

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.