Beispiel #1
0
        public bool Equals(DbRowObjectMap other)
        {
            if (other is null)
            {
                return(false);
            }

            if (other.Count != Count)
            {
                return(false);
            }

            for (int i = Count - 1; i >= 0; i--)
            {
                if (this[i].Key != other[i].Key)
                {
                    return(false);
                }

                if (this[i].Value != other[i].Value)
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        internal static DbRowObjectMap CreateMap(DbDataReader dbDataReader)
        {
            var map = new DbRowObjectMap {
                Capacity = dbDataReader.FieldCount
            };

            for (int i = 0; i < dbDataReader.FieldCount; i++)
            {
                map.Add(dbDataReader.GetName(i), RW.ValueInterface.GetInterface(dbDataReader.GetFieldType(i)));
            }

            return(map);
        }
Beispiel #3
0
        internal static DbRowObject ValueOf(DbDataReader dbDataReader, DbRowObjectMap dbRowObjectMap)
        {
            var values = new object[dbRowObjectMap.Count];

            for (int i = 0; i < values.Length; i++)
            {
                var value = dbDataReader[i];

                if (value == DBNull.Value)
                {
                    value = null;
                }

                values[i] = value;
            }

            return(new DbRowObject(dbRowObjectMap, values));
        }
Beispiel #4
0
        internal DbRowObject(DbRowObjectMap map, object[] values)
        {
            Map = map;

            Values = values;
        }