public void AddTableToLoadData(TableBase table)
 {
     this.CustomTablesToSelect.Add(table);
 }
        public void FillDataToNewRow(IDataReader reader, List <Column> columns, TableBase table, ref int i)
        {
            var r = table.GetNewRow();

            r.DbHelpers.IsNew    = false;
            r.DbHelpers.Provider = Provider;
            // r.DbHelpers.Table = this;

            foreach (var col in columns)
            {
                var pi = r.GetType().GetProperty(col.PropertyName);
                try
                {
                    if (reader.IsDBNull(i))
                    {
                        if (!Settings.SetDBNullToDefaultClassValue)
                        {
                            if (col.AllowNull)
                            {
                                pi.SetValue(r, null);
                            }
                            else
                            {
                                //Settings.Log.LogSQL($"Column {col.PropertyName} is not nullable type but data has null value.",null);
                            }
                        }
                    }
                    else
                    {
                        var val = reader.GetValue(i);
                        pi.SetValue(r, provider.ReaderReturnNetType(val));
                    }
                }
                catch (Exception e)
                {
                    Settings.Log.LogSQL($"Set value from column {col.DbName} to property {col.PropertyName} failed. " + e.ToString(), null);
                }

                i++;
            }

            if (table.CustomColumnsToSelect.Count > 0)
            {
                r.DbHelpers.CustomColumnValues = new Dictionary <string, object>();
            }

            foreach (var custColumn in table.CustomColumnsToSelect)
            {
                try
                {
                    if (custColumn.IsInSelect)
                    {
                        i++;
                        r.DbHelpers.CustomColumnValues.Add(custColumn.GetFullName(),
                                                           provider.ReaderReturnNetType(reader.GetValue(i - 1)));
                    }
                }
                catch (Exception e)
                {
                    Settings.Log.LogSQL(e.ToString(), null);
                }
            }
        }
 public void AddJoin(JoinTypeEnum type, TableBase table, Column columnLeft, Column columnRight, bool loadJoinTableData)
 {
     AddJoin(type, table, columnLeft, columnRight);
     AddTableToLoadData(table);
 }
 public RowBase(TableBase table)
 {
     DbHelpers.Table = table;
 }