Flex vs. NET Interop (eight): Remote access using FLUORINEFX gateways

Source: Internet
Author: User

About remote access in this series of articles have written a lot of examples, this article is not prepared to delve into, in order to consolidate the FluorineFX gateway learning and use. In this paper, we will use the FluorineFX gateway to provide a number of functions such as data services to introduce the relevant knowledge of remote access through FLUORINEFX.

FLUORINEFX provides remote access including a number of aspects of the knowledge point, this article only describes three of them: access to the remote object return object, return to the DataTable, return the DataSet object. FluorineFX installation package with the associated sample program, To learn more you can refer directly to these sample programs.

Before implementing the visit, we also do some preparatory work to establish the remote objects, as follows:

1 namespace Fluorine.ServiceLibrary
2 {
3 public class Book
4 {
5 public int Id { get; set; }
6 public string Name { get; set; }
7 public string Author { get; set; }
8 public double Price { get; set; }
9 }
10 }

The following are the remote objects that provide flex access:

1 namespace Fluorine.servicelibrary
2 {
3 [Remotingservice]
4 public class Fluorineservice
5 {
6///<summary>
7///Returns a Simple object
8///</summary>
9///<returns></returns>
Ten public book GetBook ()
11 {
Return to new book
13 {
Id = 1,
Name = "The Kingdoms of the",
Author = "Luo Guan Zhong",
Price = 100
18};
19}
20
///<summary>
22///return DataTable Object
///</summary>
///<returns></returns>
[Datatabletype ("Fluorine.ServiceLibrary.Book")]
Num public DataTable getdatatable ()
27 {
DataTable dt = new DataTable ("book");
DT. Columns.Add ("Id", typeof (int));
DT. Columns.Add ("Name", typeof (String));
DT. Columns.Add ("Author", typeof (String));
DT. Columns.Add ("Price", typeof (Double));
33
DataRow dr = dt. NewRow ();
dr["Id" = 1;
dr["Name" = "The Kingdoms of the";
Panax Notoginseng dr["Author"] = "Luo Guan zhong";
dr["price"] = 52.30;
DT. Rows.Add (DR);
40
Dr = dt. NewRow ();
dr["Id" = 2;
dr["Name" = "Journey to the Westward";
dr["Author"] = "en";
dr["price"] = 39.91;
DT. Rows.Add (DR);
47
The return DT;
49}
50
Wuyi///<summary>
52///Return DataSet object
///</summary>
///<returns></returns>
[Datasettype ("Fluorine.ServiceLibrary.Book")]
The public DataSet GetDataSet ()
57 {
The DataSet ds = new DataSet ("DS");
The DataTable dt = ds. Tables.add ("books");
DT. Columns.Add ("Id", typeof (int));
DT. Columns.Add ("Name", typeof (String));
DT. Columns.Add ("Author", typeof (String));
DT. Columns.Add ("Price", typeof (Double));
64
DataRow dr = dt. NewRow ();
dr["Id" = 1;
dr["Name" = "The Kingdoms of the";
dr["Author"] = "Luo Guan zhong";
dr["Price" = 52.30;
DT. Rows.Add (DR);
71
Dr = dt. NewRow ();
dr["Id" = 2;
dr["Name" = "Journey to the Westward";
dr["Author"] = "en";
dr["Price" = 39.91;
+ dt. Rows.Add (DR);
78
return DS;
80}
81
82}
83}

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.