本文整理汇总了C#中IUnityContainer.StepScopeRegistration方法的典型用法代码示例。如果您正苦于以下问题:C# IUnityContainer.StepScopeRegistration方法的具体用法?C# IUnityContainer.StepScopeRegistration怎么用?C# IUnityContainer.StepScopeRegistration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnityContainer
的用法示例。
在下文中一共展示了IUnityContainer.StepScopeRegistration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadArtifacts
public override void LoadArtifacts(IUnityContainer unityContainer)
{
// Step 1
// Registering reader
unityContainer.StepScopeRegistration<IItemReader<Person>, FlatFileItemReader<Person>>("job2Reader")
.Property("LineMapper").Instance(new DefaultLineMapper<Person>
{
Tokenizer = new DelimitedLineTokenizer { Delimiter = "," },
FieldSetMapper = new PersonMapper()
})
.Property("Resource").Resource(TestPathIn)
.Register();
// Registering Processor
unityContainer.RegisterStepScope<IItemProcessor<Person, Person>, MyFaultyFlatFileProcessor3>("job2Processor");
// Registering writer
unityContainer.StepScopeRegistration<IItemWriter<Person>, FlatFileItemWriter<Person>>("job2Writer")
.Property("LineAggregator").Instance(new DelimitedLineAggregator<Person>
{
Delimiter = ";",
FieldExtractor = new PropertyFieldExtractor<Person> { Names = new List<string> { "Firstname", "Name", "BirthYear" } }
})
.Property("Resource").Resource(TestPathOut)
.Register();
}
示例2: LoadArtifacts
public override void LoadArtifacts(IUnityContainer unityContainer)
{
unityContainer.RegisterSingleton<ITaskExecutor, SimpleAsyncTaskExecutor>();
// Step 1
// Registering reader
unityContainer.StepScopeRegistration<IItemReader<Person>, FlatFileItemReader<Person>>("reader")
.Property("LineMapper").Instance(new DefaultLineMapper<Person>
{
Tokenizer = new DelimitedLineTokenizer { Delimiter = "," },
FieldSetMapper = new PersonMapper()
})
.Property("Resource").Resource("#{stepExecutionContext['fileName']}")
.Register();
// Registering Processor
unityContainer.RegisterStepScope<IItemProcessor<Person, Person>, UppercaseProcessor>("processor");
// Registering writer
unityContainer.StepScopeRegistration<IItemWriter<Person>, FlatFileItemWriter<Person>>("writer")
.Property("LineAggregator").Instance(new DelimitedLineAggregator<Person>
{
Delimiter = ",",
FieldExtractor = new PropertyFieldExtractor<Person> { Names = new List<string> { "Name", "Firstname" } }
})
.Property("Resource").Resource(TestPathOutPrefix + "#{stepExecutionContext['partitionId']}.txt")
.Register();
unityContainer.SingletonRegistration<IPartitioner, MultiResourcePartitioner>("partitioner")
.Property("Resources").Resources(TestDataDirectoryIn + "Job10In?.txt")
.Register();
}
示例3: RegisterStep1Tasklet
// Step step1 - Sort step
private void RegisterStep1Tasklet(IUnityContainer container)
{
container.StepScopeRegistration<ITasklet, SortTasklet>("step1Batchlet")
.Property("Input").Resources("#{settings['SORTJOB.step1.inputFiles']}")
.Property("Output").Resource("#{settings['SORTJOB.step1.outputFile']}")
.Property("HeaderSize").Value(0)
.Property("Include").Value("(75,2,BI,NE,X'5244')")
.Property("Separator").Value(Environment.NewLine)
.Property("SortCard").Value("FORMAT=CH,FIELDS=(121,14,CH,A)")
.Register();
}
示例4: LoadArtifacts
/// <summary>
/// Registers the artifacts required to execute the steps (tasklets, readers, writers, etc.)
/// </summary>
/// <param name="container">the unity container to use for registrations</param>
public override void LoadArtifacts(IUnityContainer container)
{
//Connection string
var writerConnectionstring = ConfigurationManager.ConnectionStrings["Default"];
//input file
var inputFileResource = new FileSystemResource("data/input/LargeFlatFile.txt");
// Reader - FlatFileReader/FlatFileReader
container.StepScopeRegistration<IItemReader<FlatFileRecord>, FlatFileItemReader<FlatFileRecord>>("FlatFileReader/FlatFileReader")
.Property("Resource").Value(inputFileResource)
.Property("Encoding").Value(Encoding.GetEncoding("UTF-8"))
.Property("LineMapper").Reference<ILineMapper<FlatFileRecord>>("FlatFileReader/FlatFileReader/LineMapper")
.Register();
// Line mapper
container.StepScopeRegistration<ILineMapper<FlatFileRecord>, DefaultLineMapper<FlatFileRecord>>("FlatFileReader/FlatFileReader/LineMapper")
.Property("Tokenizer").Reference<ILineTokenizer>("FlatFileReader/FlatFileReader/Tokenizer")
.Property("FieldSetMapper").Reference<IFieldSetMapper<FlatFileRecord>>("FlatFileReader/FlatFileReader/FieldSetMapper")
.Register();
// Tokenizer
container.StepScopeRegistration<ILineTokenizer, DelimitedLineTokenizer>("FlatFileReader/FlatFileReader/Tokenizer")
.Property("Delimiter").Value(";")
.Register();
// Field set mapper
container.RegisterStepScope<IFieldSetMapper<FlatFileRecord>, FlatFileRecordMapper>("FlatFileReader/FlatFileReader/FieldSetMapper");
// Processor - FlatFileReader/Processor
container.RegisterStepScope<IItemProcessor<FlatFileRecord, FlatFileRecord>,FlatFileRecordProcessor >("FlatFileReader/Processor");
// Writer - FlatFileReader/DatabaseWriter
container.StepScopeRegistration<IItemWriter<FlatFileRecord>, DatabaseBatchItemWriter<FlatFileRecord>>("FlatFileReader/DatabaseWriter")
.Property("ConnectionString").Instance(writerConnectionstring)
.Property("Query").Value("INSERT INTO BA_FLATFILE_READER_TABLE (CODE,NAME,DESCRIPTION,DATE) VALUES (:code,:name,:description,:date)")
.Property("DbParameterSourceProvider").Reference<PropertyParameterSourceProvider<FlatFileRecord>>()
.Register();
}
示例5: RegisterStep0Tasklet
// Step step0 - Sort step
private void RegisterStep0Tasklet(IUnityContainer container)
{
IList<OutputFile> list = new List<OutputFile>();
var outputFile1 = new OutputFile
{
Include = "75,2,CH,EQ,C'RD'",
Outrec = "25,200"
};
var outputFile2 = new OutputFile
{
Include = "75,2,CH,EQ,C'XD'"
};
var outputFile3 = new OutputFile
{
Include = "75,2,CH,EQ,C'CD'"
};
var outputFile4 = new OutputFile
{
Include = "75,2,CH,EQ,C'YD'"
};
var outputFile5 = new OutputFile
{
};
list.Add(outputFile1);
list.Add(outputFile2);
list.Add(outputFile3);
list.Add(outputFile4);
list.Add(outputFile5);
container.StepScopeRegistration<ITasklet, CustomSortTasklet>("step0Batchlet")
.Property("Input").Resources("#{settings['SORTJOB.step0.inputFiles']}")
.Property("Output").Resource("#{settings['SORTJOB.step0.outputFile']}")
.Property("HeaderSize").Value(0)
.Property("outputFile").Value(list)
.Property("Separator").Value(Environment.NewLine)
.Property("SortCard").Value("FORMAT=CH,FIELDS=(121,14,CH,A)")
.Register();
}