예제 #1
0
 /// <summary>
 /// Read the schemas from the database;
 /// </summary>
 /// <param name="sqlTransConnection">the TransConnection.</param>
 /// <returns>the tables</returns>
 public List <SqlSysSchema> ReadSchemas(SqlTransConnection sqlTransConnection)
 {
     using (var command = sqlTransConnection.SqlCommand(System.Data.CommandType.Text, SqlSysSchema.SELECTStatement)) {
         var sqlResults = SqlUtility.ExecuteReader(command, false, false);
         var result     = EntityFlexible.ConvertFromSqlResult <SqlSysSchema>(nameof(SqlSysSchema), sqlResults.First(), SqlSysSchema.Factory);
         result.ForEach((item) => { this.SchemaById[item.schema_id] = item; });
         return(result);
     }
 }
예제 #2
0
 /// <summary>
 /// Read the types from the database.
 /// </summary>
 /// <param name="sqlTransConnection">the TransConnection.</param>
 /// <returns>the columns.</returns>
 public List <SqlSysType> ReadTypes(SqlTransConnection sqlTransConnection)
 {
     using (var command = sqlTransConnection.SqlCommand(System.Data.CommandType.Text, SqlSysType.SELECTStatement)) {
         var sqlResults = SqlUtility.ExecuteReader(command, false, false);
         var result     = EntityFlexible.ConvertFromSqlResult <SqlSysType>(nameof(SqlSysType), sqlResults.First(), SqlSysType.Factory);
         result.ForEach((item) => {
             this.Types.Add(item);
             this.TypesByUserId[item.user_type_id] = item;
         });
         return(result);
     }
 }
예제 #3
0
 /// <summary>
 /// Read all objects from the db
 /// </summary>
 /// <param name="sqlTransConnection">the transConnection to use.</param>
 public void ReadAll(SqlTransConnection sqlTransConnection)
 {
     this.ReadSchemas(sqlTransConnection);
     this.ReadAllObjects(sqlTransConnection);
     this.ReadTypes(sqlTransConnection);
     this.ReadColumns(sqlTransConnection);
     this.ReadParameters(sqlTransConnection);
     this.ReadIndex(sqlTransConnection);
     this.ReadIndexColumn(sqlTransConnection);
     this.ReadForeignKey(sqlTransConnection);
     this.ReadForeignKeysColumn(sqlTransConnection);
 }
예제 #4
0
 /// <summary>
 /// Read the index from the database.
 /// </summary>
 /// <param name="sqlTransConnection">the TransConnection.</param>
 /// <returns>the columns.</returns>
 public List <SqlSysForeignKey> ReadForeignKey(SqlTransConnection sqlTransConnection)
 {
     using (var command = sqlTransConnection.SqlCommand(System.Data.CommandType.Text, SqlSysForeignKey.SELECTStatement)) {
         var sqlResults = SqlUtility.ExecuteReader(command, false, false);
         var result     = EntityFlexible.ConvertFromSqlResult <SqlSysForeignKey>(nameof(SqlSysForeignKey), sqlResults.First(), SqlSysForeignKey.Factory);
         result.ForEach((item) => {
             {
                 var obj = this.AllObjectsById.GetValueOrDefault(item.object_id);
                 if (obj != null)
                 {
                     obj.GetForeignKeys().Add(item);
                 }
             }
         });
         return(result);
     }
 }
예제 #5
0
 /// <summary>
 /// Read the IndexColumn from the database.
 /// </summary>
 /// <param name="sqlTransConnection">the TransConnection.</param>
 /// <returns>the columns.</returns>
 public List <SqlSysIndexColumn> ReadIndexColumn(SqlTransConnection sqlTransConnection)
 {
     using (var command = sqlTransConnection.SqlCommand(System.Data.CommandType.Text, SqlSysIndexColumn.SELECTStatement)) {
         var sqlResults = SqlUtility.ExecuteReader(command, false, false);
         var result     = EntityFlexible.ConvertFromSqlResult <SqlSysIndexColumn>(nameof(SqlSysIndexColumn), sqlResults.First(), SqlSysIndexColumn.Factory);
         result.ForEach((item) => {
             {
                 var obj = this.AllObjectsById.GetValueOrDefault(item.object_id);
                 if ((object)obj != null)
                 {
                     var index = obj.GetIndexes().Where(_ => _.index_id == item.index_id).FirstOrDefault();
                     if ((object)index != null)
                     {
                         index.IndexColumns.Add(item);
                     }
                 }
             }
         });
         return(result);
     }
 }
예제 #6
0
 /// <summary>
 /// Release the TransConnection.
 /// </summary>
 public void Dispose()
 {
     using (var tc = this.TransConnection) {
         this.TransConnection = null;
     }
 }