Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
wbinford committed Apr 7, 2010
2 parents c6927a9 + e7fd055 commit c63da7b
Show file tree
Hide file tree
Showing 75 changed files with 3,408 additions and 2,909 deletions.
109 changes: 60 additions & 49 deletions Rhino.Etl.Core/ConventionOperations/ConventionInputCommandOperation.cs
@@ -1,50 +1,61 @@
namespace Rhino.Etl.Core.ConventionOperations
{
using System.Data;
using Operations;

/// <summary>
/// A convention based version of <see cref="InputCommandOperation"/>. Will
/// figure out as many things as it can on its own.
/// </summary>
public class ConventionInputCommandOperation : InputCommandOperation
{
private string command;

/// <summary>
/// Gets or sets the command to get the input from the database
/// </summary>
public string Command
{
get { return command; }
set { command = value; }
}

/// <summary>
/// Initializes a new instance of the <see cref="ConventionInputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringName">Name of the connection string.</param>
public ConventionInputCommandOperation(string connectionStringName) : base(connectionStringName)
{
}

/// <summary>
/// Creates a row from the reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <returns></returns>
protected override Row CreateRowFromReader(IDataReader reader)
{
return Row.FromReader(reader);
}

/// <summary>
/// Prepares the command for execution, set command text, parameters, etc
/// </summary>
/// <param name="cmd">The command.</param>
protected override void PrepareCommand(IDbCommand cmd)
{
cmd.CommandText = Command;
}
}
using System.Configuration;

namespace Rhino.Etl.Core.ConventionOperations
{
using System.Data;
using Operations;

/// <summary>
/// A convention based version of <see cref="InputCommandOperation"/>. Will
/// figure out as many things as it can on its own.
/// </summary>
public class ConventionInputCommandOperation : InputCommandOperation
{
private string command;

/// <summary>
/// Gets or sets the command to get the input from the database
/// </summary>
public string Command
{
get { return command; }
set { command = value; }
}

/// <summary>
/// Initializes a new instance of the <see cref="ConventionInputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringName">Name of the connection string.</param>
public ConventionInputCommandOperation(string connectionStringName) : this(ConfigurationManager.ConnectionStrings[connectionStringName])
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ConventionInputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringSettings">Name of the connection string.</param>
public ConventionInputCommandOperation(ConnectionStringSettings connectionStringSettings)
: base(connectionStringSettings)
{
}

/// <summary>
/// Creates a row from the reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <returns></returns>
protected override Row CreateRowFromReader(IDataReader reader)
{
return Row.FromReader(reader);
}

/// <summary>
/// Prepares the command for execution, set command text, parameters, etc
/// </summary>
/// <param name="cmd">The command.</param>
protected override void PrepareCommand(IDbCommand cmd)
{
cmd.CommandText = Command;
}
}
}
@@ -1,57 +1,68 @@
namespace Rhino.Etl.Core.ConventionOperations
{
using System;
using System.Collections;
using System.Data;
using Operations;

/// <summary>
/// A convention based version of <see cref="OutputCommandOperation"/>. Will
/// figure out as many things as it can on its own.
/// </summary>
public class ConventionOutputCommandOperation : OutputCommandOperation
{
private string command;


/// <summary>
/// Initializes a new instance of the <see cref="ConventionOutputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringName">Name of the connection string.</param>
public ConventionOutputCommandOperation(string connectionStringName)
: base(connectionStringName)
{
}

/// <summary>
/// Gets or sets the command to execute against the database
/// </summary>
public string Command
{
get { return command; }
set { command = value; }
}

/// <summary>
/// Prepares the row by executing custom logic before passing on to the <see cref="PrepareCommand"/>
/// for further process.
/// </summary>
/// <param name="row">The row.</param>
protected virtual void PrepareRow(Row row)
{
}

/// <summary>
/// Prepares the command for execution, set command text, parameters, etc
/// </summary>
/// <param name="cmd">The command.</param>
/// <param name="row">The row.</param>
protected override void PrepareCommand(IDbCommand cmd, Row row)
{
PrepareRow(row);
cmd.CommandText = Command;
CopyRowValuesToCommandParameters(currentCommand, row);
}

}
using System.Configuration;

namespace Rhino.Etl.Core.ConventionOperations
{
using System;
using System.Collections;
using System.Data;
using Operations;

/// <summary>
/// A convention based version of <see cref="OutputCommandOperation"/>. Will
/// figure out as many things as it can on its own.
/// </summary>
public class ConventionOutputCommandOperation : OutputCommandOperation
{
private string command;


/// <summary>
/// Initializes a new instance of the <see cref="ConventionOutputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringName">Name of the connection string.</param>
public ConventionOutputCommandOperation(string connectionStringName)
: this(ConfigurationManager.ConnectionStrings[connectionStringName])
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ConventionOutputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringSettings">Connection string settings to use.</param>
public ConventionOutputCommandOperation(ConnectionStringSettings connectionStringSettings)
: base(connectionStringSettings)
{
}

/// <summary>
/// Gets or sets the command to execute against the database
/// </summary>
public string Command
{
get { return command; }
set { command = value; }
}

/// <summary>
/// Prepares the row by executing custom logic before passing on to the <see cref="PrepareCommand"/>
/// for further process.
/// </summary>
/// <param name="row">The row.</param>
protected virtual void PrepareRow(Row row)
{
}

/// <summary>
/// Prepares the command for execution, set command text, parameters, etc
/// </summary>
/// <param name="cmd">The command.</param>
/// <param name="row">The row.</param>
protected override void PrepareCommand(IDbCommand cmd, Row row)
{
PrepareRow(row);
cmd.CommandText = Command;
CopyRowValuesToCommandParameters(currentCommand, row);
}

}
}
@@ -1,56 +1,65 @@
using System;
using Rhino.Etl.Core.Operations;

namespace Rhino.Etl.Core.ConventionOperations
{
/// <summary>Convertion wrapper around the <see cref="SqlBulkInsertOperation"/>.</summary>
public class ConventionSqlBulkInsertOperation : SqlBulkInsertOperation
{
/// <summary>Creates a new <see cref="ConventionSqlBulkInsertOperation"/></summary>
/// <param name="connectionStringName"></param>
/// <param name="targetTable"></param>
public ConventionSqlBulkInsertOperation(string connectionStringName, string targetTable) : base(connectionStringName, targetTable)
{
}

/// <summary>
/// Prepares the schema of the target table
/// </summary>
protected override void PrepareSchema()
{
}

/// <summary>
/// Prepares the mapping for use, by default, it uses the schema mapping.
/// This is the preferred appraoch
/// </summary>
public override void PrepareMapping()
{
}

/// <summary>Adds a column to the destination mapping.</summary>
/// <param name="destinationColumn">The name of column, this is case sensitive.</param>
public virtual void MapColumn(string destinationColumn)
{
MapColumn(destinationColumn, typeof (string));
}

/// <summary>Adds a column and specified type to the destination mapping.</summary>
/// <param name="destinationColumn">The name of the column</param>
/// <param name="columnType">The type of the column.</param>
public virtual void MapColumn(string destinationColumn, Type columnType)
{
MapColumn(destinationColumn, destinationColumn, columnType);
}

/// <summary>Adds a column and the specified type to the destination mapping with the given sourceColumn mapping.</summary>
/// <param name="destinationColumn"></param>
/// <param name="columnType"></param>
/// <param name="sourceColumn"></param>
public virtual void MapColumn(string destinationColumn, string sourceColumn, Type columnType)
{
Schema[destinationColumn] = columnType;
Mappings[sourceColumn] = destinationColumn;
}
}
using System;
using System.Configuration;
using Rhino.Etl.Core.Operations;

namespace Rhino.Etl.Core.ConventionOperations
{
/// <summary>Convertion wrapper around the <see cref="SqlBulkInsertOperation"/>.</summary>
public class ConventionSqlBulkInsertOperation : SqlBulkInsertOperation
{
/// <summary>Creates a new <see cref="ConventionSqlBulkInsertOperation"/></summary>
/// <param name="connectionStringName"></param>
/// <param name="targetTable"></param>
public ConventionSqlBulkInsertOperation(string connectionStringName, string targetTable) : this(ConfigurationManager.ConnectionStrings[connectionStringName], targetTable)
{
}

/// <summary>Creates a new <see cref="ConventionSqlBulkInsertOperation"/></summary>
/// <param name="connectionStringSettings">Connection string settings to use.</param>
/// <param name="targetTable"></param>
public ConventionSqlBulkInsertOperation(ConnectionStringSettings connectionStringSettings, string targetTable)
: base(connectionStringSettings, targetTable)
{
}

/// <summary>
/// Prepares the schema of the target table
/// </summary>
protected override void PrepareSchema()
{
}

/// <summary>
/// Prepares the mapping for use, by default, it uses the schema mapping.
/// This is the preferred appraoch
/// </summary>
public override void PrepareMapping()
{
}

/// <summary>Adds a column to the destination mapping.</summary>
/// <param name="destinationColumn">The name of column, this is case sensitive.</param>
public virtual void MapColumn(string destinationColumn)
{
MapColumn(destinationColumn, typeof (string));
}

/// <summary>Adds a column and specified type to the destination mapping.</summary>
/// <param name="destinationColumn">The name of the column</param>
/// <param name="columnType">The type of the column.</param>
public virtual void MapColumn(string destinationColumn, Type columnType)
{
MapColumn(destinationColumn, destinationColumn, columnType);
}

/// <summary>Adds a column and the specified type to the destination mapping with the given sourceColumn mapping.</summary>
/// <param name="destinationColumn"></param>
/// <param name="columnType"></param>
/// <param name="sourceColumn"></param>
public virtual void MapColumn(string destinationColumn, string sourceColumn, Type columnType)
{
Schema[destinationColumn] = columnType;
Mappings[sourceColumn] = destinationColumn;
}
}
}

0 comments on commit c63da7b

Please sign in to comment.