예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        private EntityReader(IDbCommand command, IDataReader reader, SelectMap selectMap)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (selectMap == null)
            {
                throw new ArgumentNullException("selectMap");
            }

            _command   = command;
            _reader    = reader;
            _selectMap = selectMap;
        }
예제 #2
0
        // mbr - 15-06-2006 - added.
        private void SetEntityType(EntityType entityType, SqlDialect dialect)
        {
            if (entityType == null)
            {
                throw new ArgumentNullException("entityType");
            }
            if (dialect == null)
            {
                throw new ArgumentNullException("dialect");
            }

            // have we?
            if (_selectMap != null)
            {
                throw new InvalidOperationException("The select map for this entity has already been defined and bound to an entity.");
            }
            _selectMap        = new SelectMap(entityType);
            this.Dialect      = dialect;
            this.DatabaseName = entityType.DatabaseName;
        }
예제 #3
0
        /// <summary>
        /// Gets data for serialization.
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        private SqlStatement(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            // get...
            Type dialectType = (Type)info.GetValue("_dialectType", typeof(Type));

            if (dialectType != null)
            {
                _dialect = (SqlDialect)Activator.CreateInstance(dialectType);
            }

            // get...
            _databaseName           = info.GetString("_databaseName");
            _parameters             = (SqlStatementParameterCollection)info.GetValue("_parameters", typeof(SqlStatementParameterCollection));
            _commandText            = info.GetString("_commandText");
            _commandType            = (CommandType)info.GetValue("_commandType", typeof(CommandType));
            _selectMap              = (SelectMap)info.GetValue("_selectMap", typeof(SelectMap));
            this.Tag                = (string)info.GetValue("Tag", typeof(string));
            this.ArrayParameterType = (ArrayParameterType)info.GetValue("ArrayParameterType", typeof(ArrayParameterType));
        }