CN103218230A - Method for dynamically creating entity class under frame of Silverlight - Google Patents
Method for dynamically creating entity class under frame of Silverlight Download PDFInfo
- Publication number
- CN103218230A CN103218230A CN2013101408973A CN201310140897A CN103218230A CN 103218230 A CN103218230 A CN 103218230A CN 2013101408973 A CN2013101408973 A CN 2013101408973A CN 201310140897 A CN201310140897 A CN 201310140897A CN 103218230 A CN103218230 A CN 103218230A
- Authority
- CN
- China
- Prior art keywords
- silverlight
- character string
- dynamic
- datatable
- sequence
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Liquid Crystal (AREA)
Abstract
The invention provides a method for a dynamically creating entity class under a frame of Silverlight. According to the method, a data table type sequence not supported by the Silverlight is transformed to a character string type sequence supported by the Silverlight through the method of sequence transformation at a WCF side. The method comprises the steps: (1) a data table is serialized to be a character string through a server side and transmitted to a Silverlight side through the WCF after compression; (2) the character string is decoded and uncompressed at the Silverlight side, the uncompressed character string is analyzed so that Observable Collection (dynamic) is obtained, wherein the dynamic is of a dynamic type, and data of the data table are stored through the Observable Collection (dynamic); and (3) according to analyzed information, a case is dynamically established and assigned so that transformation of the character string type sequence is achieved, and at last the transformed character string type sequence is returned to the Silverlight side for use.
Description
Technical field
The present invention relates to the Computer Applied Technology field, the method for dynamic creation entity class under specifically a kind of silverlight framework.
Background technology
DataTable is the grid Virtual table of temporarily preserving data, it need not code simple binding data storehouse just.We know that what store in the database is entity list, has a series of data in the entity list.And DataTable promptly is stored in the table in the internal memory, before being persisted to database, can not exert an influence to database.In the project exploitation, often to use DataTable, proper if DataTable uses, can not only make program succinctly practical, and can improve performance, reach the effect of getting twice the result with half the effort.DataTable also has many methods, as: 1. obtain DataTable by constructed fuction; 2. obtain DataTable by DataSet; 3. pass through the structure of the self-defined DataTable of DataRow; 4. obtain new DataTable by existing DataTable; 5. fill DataTable by DataAdapter; 6. import DataTable by the DataRow array.
Silverlight does not support datatable, needs developer oneself definition entity class usually, datatable is converted into entity class offers the use of silverlight end, and is very big for the IT system development effortsIT amount like this, and is not easy to management.The innovation achievement is based on and improves silverlight development efficiency, is implemented in through research and does not define entity under the silverlight, sends the DataTable data to the silverlight use by creating regime type.
Summary of the invention
The method that the purpose of this invention is to provide dynamic creation entity class under a kind of silverlight framework.
The objective of the invention is to realize in the following manner, at the WCF end, the method by sequence transforms is converted into the character string type that silverlight supports with the unsupported datatable type sequence of silverlight, and concrete steps are as follows:
1) at first server end changes into character string to the datatable sequence, and the compression back is delivered to the silverlight end by WCF;
2) decompress by decoding at the silverlight end, character string after decompressing is resolved, generate ObservableCollection<dynamic 〉, wherein dynamic is a regime type, by ObservableCollection<dynamic〉deposit the Datatable data;
3) according to the information of resolving, the dynamic creation example is the example assignment also, realizes the conversion of character string type, returns to the silverlight end at last and uses.
Excellent effect of the present invention: the Silverlight technological frame is not supported the datatable technology, usually need developer oneself definition entity class, datatable is converted into entity class offers the use of silverlight end, very big for the IT system development effortsIT amount like this, and be not easy to management.The present invention is based on and improves silverlight development efficiency, be implemented in and do not define entity under the silverlight, send the DataTable data to the silverlight use by creating regime type, having liberated developer oneself definition entity class and datatable is converted into entity class provides silverlight the coding work amount that end uses, and has improved developer's work efficiency greatly.
Description of drawings
Fig. 1 is WCF end realization flow figure;
Fig. 2 is WCFSilverlight end realization flow figure.
Embodiment
Explain below with reference to Figure of description method of the present invention being done.
Embodiment
End:
1, at first, the DataTable sequence is turned to string, information such as table name, row name are kept in the string string, partial code is as follows:
Private?static?string?SerializeDataTable(Datatable?dt,int?ipIndex)
{
Try
{
StringBuilder?strResult=new?StringBuilder()
String?strTableName=””;
StrtablName=dt.TableName;
If?(strTableName==””)
StrtablName=“TABLENAME_”+ipIndex,?ToString();
strResult.Appdend(“▲”);
for(int?s=0:s<dt.Columns.Count:s++)
strResult.Appdend(dt.Columns[s].ColumnName);
2, will obtain character string and carry out encoding compression:
Byte[]bytes=System.Text.Encoding.UTF8.GetBytes(str);
Byte[]bR=Utils.Compress(bytes);
Return?System.Convert.ToBase64String(bR)
The Silverlight end:
At first,, the character string parsing behind the decompress(ion) is obtained table name with the character string decompression of decoding, the row name, information such as row type, partial code is as follows:
String[]?listMain=strDe.Split(‘▲’);
lsttableName[i]=listMain[0];
DicDy[lsttableName[i]=lstdy[i];
strTemp=listMain[1];
string[]?listField=strTemp.Split(‘■’);
listFieldNamelst[i]=listField[0];
DicFieldName[lsttableName=listFieldType[0];.Split(‘▼’);
strTemp=listField[1];
strTemp?[]listFieldType=strTemp.split(‘□’);
lstFieldTypelst[i]=listFieldType[0];
DicFiledType[lsttbleName[0].split(‘?▼’);
For?(int?j=0:j<FildName.length:j++)
2, according to the information creating dynamic instance of resolving, be the example assignment, partial code is as follows:
For?(int?s=0:s<listRow.length:s++)
{
Dynamic?myClass=Activator.CreateInstans(MyTape);
String[]col=listRow[s].Split(‘?▼’);∣
For(int?j=0:j<col.length:j++)
{
String?strTran=col[j];
If?(FileldType[j]==”System.String”)
{
strTran=UnStrReplace(col[j]);
}
Object?0Data=TranStrT0object(strTran,FildType[j]);
MyClassProperty.SetValue(myClass,0Data,null);
}
obList.Add(myClass);
3, create ObservableCollection<dynamic〉example and return for the silverlight end and call.
Except that the described technical characterictic of instructions, be the known technology of those skilled in the art.
Claims (1)
1. the method for dynamic creation entity class under the silverlight framework, it is characterized in that holding at WCF, method by sequence transforms is converted into the character string type that silverlight supports with the unsupported datatable type sequence of silverlight, and concrete steps are as follows:
1) at first server end changes into character string to the datatable sequence, and the compression back is delivered to the silverlight end by WCF;
2) decompress by decoding at the silverlight end, character string after decompressing is resolved, generate ObservableCollection<dynamic 〉, wherein dynamic is a regime type, by ObservableCollection<dynamic〉deposit the Datatable data;
3) according to the information of resolving, the dynamic creation example is the example assignment also, realizes the conversion of character string type, returns to the silverlight end at last and uses.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101408973A CN103218230A (en) | 2013-04-23 | 2013-04-23 | Method for dynamically creating entity class under frame of Silverlight |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101408973A CN103218230A (en) | 2013-04-23 | 2013-04-23 | Method for dynamically creating entity class under frame of Silverlight |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103218230A true CN103218230A (en) | 2013-07-24 |
Family
ID=48816058
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2013101408973A Pending CN103218230A (en) | 2013-04-23 | 2013-04-23 | Method for dynamically creating entity class under frame of Silverlight |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103218230A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107656723A (en) * | 2017-08-17 | 2018-02-02 | 成都好医生医学检验所有限公司 | A kind of flow engine frame design method based on WF4.5 |
CN117055994A (en) * | 2023-07-31 | 2023-11-14 | 广东保伦电子股份有限公司 | Implementation method and processing terminal based on data-driven UI (user interface) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070033573A1 (en) * | 1998-10-30 | 2007-02-08 | Armand Nachef | Dynamic creation of object classes |
CN101882156A (en) * | 2010-06-13 | 2010-11-10 | 用友软件股份有限公司 | Controllable cache method and system of Silverlight client side |
CN102209076A (en) * | 2011-06-03 | 2011-10-05 | 用友软件股份有限公司 | Method and system for interaction between server and client |
-
2013
- 2013-04-23 CN CN2013101408973A patent/CN103218230A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070033573A1 (en) * | 1998-10-30 | 2007-02-08 | Armand Nachef | Dynamic creation of object classes |
CN101882156A (en) * | 2010-06-13 | 2010-11-10 | 用友软件股份有限公司 | Controllable cache method and system of Silverlight client side |
CN102209076A (en) * | 2011-06-03 | 2011-10-05 | 用友软件股份有限公司 | Method and system for interaction between server and client |
Non-Patent Citations (1)
Title |
---|
张学林: ""基于WCF和Silverlight的Web应用框架技术研究"", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107656723A (en) * | 2017-08-17 | 2018-02-02 | 成都好医生医学检验所有限公司 | A kind of flow engine frame design method based on WF4.5 |
CN107656723B (en) * | 2017-08-17 | 2020-11-10 | 成都好医生医学检验所有限公司 | Process engine framework design method based on WF4.5 |
CN117055994A (en) * | 2023-07-31 | 2023-11-14 | 广东保伦电子股份有限公司 | Implementation method and processing terminal based on data-driven UI (user interface) |
CN117055994B (en) * | 2023-07-31 | 2024-02-27 | 广东保伦电子股份有限公司 | Data-driven-based interactive interface implementation method and processing terminal |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9477682B1 (en) | Parallel compression of data chunks of a shared data object using a log-structured file system | |
WO2017096940A1 (en) | Data import method for spark-sql-based big-data processing platform | |
KR100614677B1 (en) | Method for compressing/decompressing a structured document | |
CN102999480B (en) | The method and system of Edit Document | |
CN107168695B (en) | Excel data analysis method and system | |
CN104408100B (en) | The compression method of structured web site daily record | |
CN103729429A (en) | Hbase based compression method | |
US20200212932A1 (en) | Reducing storage of blockchain metadata via dictionary-style compression | |
Aihkisalo et al. | A performance comparison of web service object marshalling and unmarshalling solutions | |
WO2017036348A1 (en) | Method and device for compressing and decompressing extensible markup language document | |
Lenhardt et al. | Gipfeli-high speed compression algorithm | |
CN102214170B (en) | Methods and systems for compressing and decompressing extensible markup language (XML) data | |
CN103218230A (en) | Method for dynamically creating entity class under frame of Silverlight | |
Al-Shammary et al. | SOAP web services compression using variable and fixed length coding | |
US20170109150A1 (en) | Data compaction | |
Jaiswal et al. | Why use Efficient XML Interchange instead of Fast Infoset | |
CN105607892A (en) | Concurrent execution method and system for multiple programs | |
Tamrakar et al. | A Compression Algorithm for Optimization of Storage Consumption of Non Oracle Database | |
CN104317935A (en) | Method and system for generating HTML (hypertext markup language) pages from XML (extensible markup language) bill files in batches | |
Masui | Bitshuffle: Filter for improving compression of typed binary data | |
CN104361079A (en) | Method and system for automatically extracting duplicate data | |
CN102708191A (en) | Word stock coding and decoding method capable of saving memory | |
Rattanaopas et al. | A comparison of orc-compress performance with big data workload on virtualization | |
CN104270454A (en) | CDN dynamic application acceleration method based on data transmission optimizing system | |
CN110569456A (en) | WEB end data offline caching method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20130724 |
|
WD01 | Invention patent application deemed withdrawn after publication |