I remember that shortly after I got in touch with the computer, I was shocked by the novelty of this guy's "Memory" and the "accuracy" he was looking for. Although these have gone far, however, its data storage and search are
The primary feature is how developers and users can process and use data more quickly. Here, I would like to share my experiences, for more information ,,,,
When I used to store data, I always used. Net built-in controls, such as dataset, sqldataadapter, and sqlcommand... It's easy to start using, but with the modification later,
That's getting bored ,. net automatically generated code is always confused in the cloud, so now we want to implement a function (storage) is not much different, and data completion is controlled by some of our own classes.
You can be free.
Of course, this requires some object-oriented basics, because these are fully object-based.
The most widely used data storage should be a table. A table is composed of records, records are composed of fields, field names and types. Of course, it starts with fields:
The storage field is simple, for example:
Source Field:
Protected dictionary <string, Object> originaldata;
Current Field to be modified:
Protected dictionary <string, Object> currentdata;
Just wait for our storage.
To distinguish between new data and data marked as deleted, two bool variables are defined:
Protected bool isnew;
Protected bool isdeleted;
In this way, we can define the record constructor:
Code
Public tableitem ()
{
Isnew = true;
Isdeleted = false;
Originaldata = new dictionary <string, Object> ();
Currentdata = new dictionary <string, Object> ();
}
At this point, you can use it like this:
Assume that a table has six fields: tc_mmstb001, tc_mmstb002, tc_mmstb003, tc_mmstb004, and tc_mmstb005.
Then you can write a record class,
Code
Public class mmstbitem: dataawareobjecttest. tableitem
{
Public mmstbitem (): This (string. Empty, String. Empty ){}
Public mmstbitem (string mmstb001, string mmstb002, string mmstb003, string mmstb004, string mmstb005, string rowid)
{
Currentdata. Add ("tc_mmstb001", mmstb001 );
Currentdata. Add ("tc_mmstb002", mmstb002 );
Currentdata. Add ("tc_mmstb003", mmstb003 );
Currentdata. Add ("tc_mmstb004", mmstb004 );
Currentdata. Add ("tc_mmstb005", mmstb005 );
Currentdata. Add ("rowid", rowid );
Originaldata. Add ("tc_mmstb001", mmstb001 );
Originaldata. Add ("tc_mmstb002", mmstb002 );
Originaldata. Add ("tc_mmstb003", mmstb003 );
Originaldata. Add ("tc_mmstb004", mmstb004 );
Originaldata. Add ("tc_mmstb005", mmstb005 );
Originaldata. Add ("rowid", rowid );
}
(Where rowid is in Oracle)
In this way, the record class of a table is completed ---------------
Okay, it's, my eyes hurt, rest ---------
Continue tomorrow ---------------------------------