示例#1
0
        public static void SaveMetaTableClass(MetaTable table)
        {
            StringBuilder result = new StringBuilder(@"using System;

namespace AlphaOmega.Debug.CorDirectory.Meta.Tables
{
");

            result.AppendLine(String.Format("\tpublic class {0}TableRow : BaseMetaRow", table.TableType));
            result.AppendLine("\t{");

            MetaRow row = table.RowsCount == 0?null:table[0];

            if (row == null)
            {
                result.AppendLine("#warning \"Class created predictially\"");
            }

            foreach (var column in table.Columns)
            {
                result.AppendLine(String.Format("\t\tpublic {0} {1} {{ get {{ return base.GetValue<{0}>({2}); }} }}",
                                                row == null ? column.ColumnType.ToString() : row[column].Value.GetType().Name,
                                                column.Name,
                                                column.Index));
            }

            result.AppendLine("\t}");
            result.Append('}');

            //Save
            String path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), table.TableType.ToString() + "TableRow.cs");

            if (!File.Exists(path))
            {
                File.WriteAllText(path, result.ToString());
            }
        }
示例#2
0
 public virtual void RemoveMetaRow(MetaRow row) {
     this.Rows.Remove(row);
 }
示例#3
0
 public MetaRowChangedEventArgs(MetaRow r, System.Data.DataRowAction a) {
     this.eventRow = r;
     this.eventAction = a;
 }
示例#4
0
 public virtual void AddMetaRow(MetaRow row) {
     this.Rows.Add(row);
 }