diff --git a/Rhino.Etl.Core/Files/FileEngine.cs b/Rhino.Etl.Core/Files/FileEngine.cs index b750861..2a9115a 100644 --- a/Rhino.Etl.Core/Files/FileEngine.cs +++ b/Rhino.Etl.Core/Files/FileEngine.cs @@ -36,7 +36,7 @@ public void Write(object t) /// The error mode. public FileEngine OnError(ErrorMode errorMode) { - engine.ErrorMode = errorMode; + engine.ErrorManager.ErrorMode = errorMode; return this; } diff --git a/Rhino.Etl.Core/Files/FluentFile.cs b/Rhino.Etl.Core/Files/FluentFile.cs index 82f9c93..b564ee8 100644 --- a/Rhino.Etl.Core/Files/FluentFile.cs +++ b/Rhino.Etl.Core/Files/FluentFile.cs @@ -75,15 +75,15 @@ private static string NormalizeFilename(string filename) return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename); } - /// - /// Gets or sets the options. - /// - /// The options. - public RecordOptions Options - { - get { return engine.Options; } - set { engine.Options = value; } - } + ///// + ///// Gets or sets the options. + ///// + ///// The options. + //public RecordOptions Options + //{ + // get { return engine.RecordType.; } + // set { engine.Options = value; } + //} /// /// Gets or sets the footer text. diff --git a/Rhino.Etl.Core/Pipelines/ThreadPoolPipelineExecuter.cs b/Rhino.Etl.Core/Pipelines/ThreadPoolPipelineExecuter.cs index 4d7dfa7..d04dfc6 100644 --- a/Rhino.Etl.Core/Pipelines/ThreadPoolPipelineExecuter.cs +++ b/Rhino.Etl.Core/Pipelines/ThreadPoolPipelineExecuter.cs @@ -32,6 +32,9 @@ protected override IEnumerable DecorateEnumerableForExecution(IOperation op { Error(e, "Failed to execute operation {0}", operation); threadedEnumerator.MarkAsFinished(); +#if DEBUG + throw e; +#endif } finally { diff --git a/Rhino.Etl.Core/Rhino.Etl.Core.csproj b/Rhino.Etl.Core/Rhino.Etl.Core.csproj index 6d6d246..aad181c 100644 --- a/Rhino.Etl.Core/Rhino.Etl.Core.csproj +++ b/Rhino.Etl.Core/Rhino.Etl.Core.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.30729 + 9.0.21022 2.0 {DC42946E-5972-411C-A061-F2932E49C31F} Library @@ -57,7 +57,7 @@ False ..\SharedLibs\Boo.Lang.dll - + False ..\SharedLibs\FileHelpers.dll diff --git a/Rhino.Etl.Tests/Rhino.Etl.Tests.csproj b/Rhino.Etl.Tests/Rhino.Etl.Tests.csproj index 3ccf36a..3bc28b6 100644 --- a/Rhino.Etl.Tests/Rhino.Etl.Tests.csproj +++ b/Rhino.Etl.Tests/Rhino.Etl.Tests.csproj @@ -64,7 +64,7 @@ False ..\SharedLibs\Boo.Lang.Parser.dll - + False ..\SharedLibs\FileHelpers.dll @@ -167,6 +167,8 @@ + + diff --git a/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFile.cs b/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFile.cs index d25b044..f883075 100644 --- a/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFile.cs +++ b/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFile.cs @@ -2,11 +2,11 @@ namespace Rhino.Etl.Tests.UsingDAL { using Core; - public class ImportUsersFromFile : EtlProcess + public class ImportUsersFromFileDynamic : EtlProcess { protected override void Initialize() { - Register(new ReadUsersFromFile()); + Register(new ReadUsersFromFileDynamic()); Register(new SaveToDal()); } } diff --git a/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFileDynamic.cs b/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFileDynamic.cs new file mode 100644 index 0000000..d25b044 --- /dev/null +++ b/Rhino.Etl.Tests/UsingDAL/ImportUsersFromFileDynamic.cs @@ -0,0 +1,13 @@ +namespace Rhino.Etl.Tests.UsingDAL +{ + using Core; + + public class ImportUsersFromFile : EtlProcess + { + protected override void Initialize() + { + Register(new ReadUsersFromFile()); + Register(new SaveToDal()); + } + } +} \ No newline at end of file diff --git a/Rhino.Etl.Tests/UsingDAL/ReadUsersFromFileDynamic.cs b/Rhino.Etl.Tests/UsingDAL/ReadUsersFromFileDynamic.cs new file mode 100644 index 0000000..f096f1c --- /dev/null +++ b/Rhino.Etl.Tests/UsingDAL/ReadUsersFromFileDynamic.cs @@ -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 Execute(IEnumerable 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); + } + } + } +} \ No newline at end of file diff --git a/Rhino.Etl.Tests/UsingDAL/UsingDALFixture.cs b/Rhino.Etl.Tests/UsingDAL/UsingDALFixture.cs index d6ff9ed..f286dfe 100644 --- a/Rhino.Etl.Tests/UsingDAL/UsingDALFixture.cs +++ b/Rhino.Etl.Tests/UsingDAL/UsingDALFixture.cs @@ -36,5 +36,16 @@ public void CanReadFromFileToDAL() Assert.Equal(5, MySimpleDal.Users.Count); } + + [Fact] + public void CanReadFromFileToDALDynamic() { + MySimpleDal.Users = new List(); + File.WriteAllText("users.txt", expected); + + var import = new ImportUsersFromFileDynamic(); + import.Execute(); + + Assert.Equal(5, MySimpleDal.Users.Count); + } } } \ No newline at end of file diff --git a/SharedLibs/FileHelpers.dll b/SharedLibs/FileHelpers.dll index 4c16720..9eb2819 100644 Binary files a/SharedLibs/FileHelpers.dll and b/SharedLibs/FileHelpers.dll differ