internal KSurrogate( IKCommand command, bool iterable ) { DEBUG.IndentLine( "\n-- KSurrogate( Iterable={0}, Command={1} )", iterable, command == null ? "null" : command.ToString() ); if( ( _Command = command ) == null ) throw new ArgumentNullException( "command", "Command cannot be null." ); if( _Command.Link == null ) throw new ArgumentException( "Command's link is null." ); _Link = _Command.Link as KLinkDirect; if( _Link == null ) throw new ArgumentException( "Command's link is not a direct link." ); Invoke( iterable ); DEBUG.Unindent(); }
protected virtual void Dispose( bool disposing ) { DEBUG.IndentLine( "\n-- KSurrogate.Dispose( Disposing={0} ) - This={1}", disposing, this ); if( _DataReader != null ) { if( !_DataReader.IsClosed ) _DataReader.Close(); _DataReader.Dispose(); _DataReader = null; } if( _Link != null ) { if( _LinkOpenedBySurrogate ) _Link.DbClose(); _Link = null; } _Schema = null; // It might be in use elsewhere _Command = null; DEBUG.Unindent(); }
/// <summary> /// Clones this link object, cloning also all the relevant elements it conceptually contains. /// <para>If any of those implements the <see cref="IKCloneable"/> interface, they are cloned using its Clone(link) /// method where the link instance is the new cloned one.</para> /// <para>Otherwise, they are cloned only if they implement the <see cref="ICloneable"/> interface and, if not, their /// original value/reference is used for the new cloned link.</para> /// </summary> /// <returns>A new cloned object.</returns> public KLinkDirect Clone() { var cloned = new KLinkDirect( Factory, _DbConnectionString, _DbCaseSensitiveNames, _TransactionMode ); OnClone( cloned ); return cloned; }