示例#1
0
        public void TableMetaRelations_ToString_should_match_child()
        {
            var tableMetaRelation = new TableMetaRelation();

            tableMetaRelation.Child = new TableMeta()
            {
                Name = "MyTable"
            };

            Assert.AreEqual(tableMetaRelation.ToString(), tableMetaRelation.Child.ToString());
        }
示例#2
0
 /// <summary>
 /// Parameterized constructor of <see cref="DetailGridTemplate"/>.
 /// </summary>
 /// <param name="masterTableMeta">Meta data of master table.</param>
 /// <param name="connectionString">The connection string to underlying database.</param>
 public DetailGridTemplate(TableMeta masterTableMeta, string connectionString, List <PermissionType> permissions)
 {
     this.masterTableMeta = masterTableMeta;
     if (masterTableMeta.Children.Where(c => c.IsRendered).Count() != 1)
     {
         throw new ArgumentException(string.Format("Master table {0} has no child table or more than 1 child tables.", masterTableMeta.Name));
     }
     this.detailTable      = masterTableMeta.Children[0];
     this.connectionString = connectionString;
     this.permissions      = permissions;
 }
示例#3
0
 /// <summary>
 /// Parameterized-constructor for <see cref="DetailGridCreator"/>.
 /// </summary>
 /// <param name="detailTable">An instance of <see cref="TableMetaRelation"/>, provides meta-data about relation
 /// between master and detail tables.</param>
 /// <param name="masterTableMeta">Master table meta data, an instance of <see cref="TableMeta"/>.</param>
 /// <param name="masterKey">The primary key of master table.</param>
 /// <param name="connectionString">Connection string to underlying database.</param>
 /// <param name="permissions"></param>
 public DetailGridCreator(TableMetaRelation detailTable, TableMeta masterTableMeta, object masterKey, string connectionString,
                          List <PermissionType> permissions)
 {
     this.detailTableMeta  = detailTable.Child;
     this.masterTableMeta  = masterTableMeta;
     this.masterKey        = masterKey;
     this.connectionString = connectionString;
     this.gridId           = string.Concat(detailTableMeta.Name.ToCamelCase(), "GridView");
     this.foreignKey       = detailTableMeta.Columns.Where(c => c.IsForeignKey == true && c.Name == detailTable.ForeignKeyName)
                             .SingleOrDefault();
     if (foreignKey == null)
     {
         throw new ArgumentException(string.Format("FK to table {0} not found", masterTableMeta.Name));
     }
     this.permissions = permissions;
 }
示例#4
0
        public void TableMetaRelations_initial_condition_test()
        {
            var tableMetaRelation = new TableMetaRelation();

            Assert.IsTrue(tableMetaRelation.IsRendered);
        }