CYQ.Data Lightweight Data Access Layer (VI) is configured Datasheet

Since the minimum unit constituting the data unit, after the row and column headers class, it has become very easy to write

Table is the same, the set of all lines, namely table, so we are also very easy to write the table class

as follows:

05233817_Lpq3.gif 05233817_PnLF.gif Code
public class MDataTable : List<MDataRow>
05233817_PnLF.gif05233817_Lpq3.gif    
{
        
private string _TableName =string.Empty;
05233817_l9hZ.gif05233817_RIPq.gif        
/**//// <summary>
        
/// 表名
        
/// </summary>

        public string TableName
05233817_l9hZ.gif05233817_RIPq.gif        
{
            
get
05233817_l9hZ.gif05233817_RIPq.gif            
{
                
return _TableName;
            }

            
set
05233817_l9hZ.gif05233817_RIPq.gif            
{
                _TableName 
= value;
            }

        }

        
public MDataTable()
05233817_l9hZ.gif05233817_RIPq.gif        
{
            _TableName 
= "Default";
        }

        
public MDataTable(string tableName)
05233817_l9hZ.gif05233817_RIPq.gif        
{
            _TableName 
= tableName;
        }


    }

At this table is the basic building good, only a default table name property

We add property to access the column header for it

as follows:

 

05233817_Lpq3.gif 05233817_PnLF.gif Code
 private MDataColumn _Columns;
        
public MDataColumn Columns
05233817_PnLF.gif05233817_Lpq3.gif        
{
            
get
05233817_l9hZ.gif05233817_RIPq.gif            
{
                
if (this.Count > 0)
05233817_l9hZ.gif05233817_RIPq.gif                
{
                    
return this[0].Columns;
                }

                
if (_Columns == null)
05233817_l9hZ.gif05233817_RIPq.gif                
{
                    _Columns 
= new MDataColumn();
                }

                
return _Columns;
            }

        }

 

At this point, the table also completed the basic building

The next section, we will realize that we make with our custom MTable common user interaction controls

Reproduced in: https: //my.oschina.net/secyaher/blog/274386

Guess you like

Origin blog.csdn.net/weixin_34168880/article/details/91966763