Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes issue 2: FileHelper now doesn't blow up when using dynamic clas…
…s creation
- Loading branch information
unknown
committed
Apr 8, 2010
1 parent
7cc19b8
commit 71d3e16
Showing
10 changed files
with
82 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
namespace Rhino.Etl.Tests.UsingDAL | |||
{ | |||
using Core; | |||
|
|||
public class ImportUsersFromFile : EtlProcess | |||
This comment has been minimized.
Sorry, something went wrong. |
|||
{ | |||
protected override void Initialize() | |||
{ | |||
Register(new ReadUsersFromFile()); | |||
Register(new SaveToDal()); | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
using System; | |||
using FileHelpers; | |||
using FileHelpers.RunTime; | |||
|
|||
namespace Rhino.Etl.Tests.UsingDAL | |||
{ | |||
using System.Collections.Generic; | |||
using Core; | |||
using Rhino.Etl.Core.Files; | |||
using Rhino.Etl.Core.Operations; | |||
using System.Linq; | |||
|
|||
public class ReadUsersFromFileDynamic : AbstractOperation | |||
{ | |||
private Type _tblClass; | |||
public ReadUsersFromFileDynamic() | |||
{ | |||
var userRecordClassBuilder = new DelimitedClassBuilder("UserRecord","\t"); | |||
userRecordClassBuilder.IgnoreFirstLines = 1; | |||
userRecordClassBuilder.AddField("Id", typeof(Int32)); | |||
userRecordClassBuilder.AddField("Name", typeof(String)); | |||
userRecordClassBuilder.AddField("Email", typeof(String)); | |||
_tblClass = userRecordClassBuilder.CreateRecordClass(); | |||
} | |||
|
|||
public override IEnumerable<Row> Execute(IEnumerable<Row> rows) | |||
{ | |||
var file = new FileHelperEngine(_tblClass); | |||
//var ary = new[] {"one", "two", "three"}; | |||
//var items = from a in ary select a; | |||
var items = file.ReadFile("users.txt"); | |||
foreach (object obj in items) | |||
{ | |||
yield return Row.FromObject(obj); | |||
} | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
looks like i switched the files around by accident. one thing i do like about Java is enforcement of filename/classname consistency