public NotificationMapper(INotificationMediumRepository notificationMediumRepository, IPopulator <NotificationEntity, Notification> notificationPopulator, IPhoneNumberFactory phoneNumberFactory) { _notificationMediumRepository = notificationMediumRepository; _notificationPopulator = notificationPopulator; _phoneNumberFactory = phoneNumberFactory; }
/// <summary> /// Use <paramref name="appDomain" /> to populate an <see cref="Unity.IUnityContainer" /> /// </summary> /// <param name="appDomain">Custom <see cref="IAssemblyProvider" /></param> public UnityContainerPopulator([NotNull] IAssemblyProvider appDomain) { this.appDomain = appDomain; typePopulator = new TypePopulator(); instancePopulator = new InstancePopulator(); factoryPopulator = new FactoryPopulator(); }
/// <summary> /// Initialise a new instance of the GeneticEngine class with the supplied plug-ins and populate the initial generation. /// </summary> /// <param name="populator">The populator plug-in. Generates the initial population.</param> /// <param name="evaluator">The evaluator plug-in. Provides the fitness function.</param> /// <param name="geneticOperator">The genetic operator plug-in. Processes one generation to produce the individuals for the next.</param> /// <param name="terminator">The terminator plug-in. Provides the termination condition.</param> /// <param name="outputter">The outputter plug-in or null for no output. Outputs each generation.</param> /// <param name="generationFactory">The generation factory plug-in or null to use the default. Creates the generation container.</param> public GeneticEngine(IPopulator populator, IEvaluator evaluator, IGeneticOperator geneticOperator, ITerminator terminator, IOutputter outputter = null, IGenerationFactory generationFactory = null) { if (populator == null) { throw new GeneticEngineException("populator must not be null"); } if (evaluator == null) { throw new GeneticEngineException("pvaluator must not be null"); } if (geneticOperator == null) { throw new GeneticEngineException("geneticOperator must not be null"); } if (terminator == null) { throw new GeneticEngineException("terminator must not be null"); } this.populator = populator; this.evaluator = evaluator; this.geneticOperator = geneticOperator; this.terminator = terminator; this.outputter = outputter; this.generationFactory = generationFactory == null ? new AATreeGenerationFactory() : generationFactory; Setup(); }
public UserFacade(IUserRepository userRepository, IUnitOfWork unitOfWork, IPopulator <User> userPopulator) { _userRepository = userRepository; _unitOfWork = unitOfWork; _userPopulator = userPopulator; }
public static void ClassInitialize(TestContext c) { const int delay = 5; const int dummy = 0; MockSimplePriceFetcher fetcher = new MockSimplePriceFetcher(); populator = new AutoPopulator(fetcher, dummy, dummy, delay); populator.setup(); }
/// <summary> /// Initializes a new instance of the <see cref="SurrogateCodec{TField, TSurrogate, TConverter}"/> class. /// </summary> /// <param name="surrogateSerializer">The surrogate serializer.</param> /// <param name="surrogateCopier">The surrogate copier.</param> /// <param name="converter">The surrogate converter.</param> public SurrogateCodec( IValueSerializer <TSurrogate> surrogateSerializer, IDeepCopier <TSurrogate> surrogateCopier, TConverter converter) { _surrogateSerializer = surrogateSerializer; _surrogateCopier = surrogateCopier; _converter = converter; _populator = converter as IPopulator <TField, TSurrogate>; _fieldType = typeof(TField); }
public static void Decorate(IPopulator populator) { populator.DecorateType<ForeignToAutoPrimaryTable>() .AddAttributeToType(new TableAttribute("TestDataFramework", "dbo", "ForeignToAutoPrimaryTable")) .AddAttributeToMember(m => m.ForignKey, new ForeignKeyAttribute("dbo", "TertiaryManualKeyForeignTable", "Pk")) .AddAttributeToMember(m => m.ForignKey, new PrimaryKeyAttribute(PrimaryKeyAttribute.KeyTypeEnum.Manual)); populator.DecorateType<TertiaryManualKeyForeignTable>() .AddAttributeToType(new TableAttribute("TestDataFramework", "dbo", "TertiaryManualKeyForeignTable")) .AddAttributeToMember(m => m.Pk, new PrimaryKeyAttribute(PrimaryKeyAttribute.KeyTypeEnum.Auto)) .AddAttributeToMember(m => m.FkManualKeyForeignTable, new ForeignKeyAttribute("dbo", "ManualKeyForeignTable", "UserId")) .AddAttributeToMember(m => m.FkStringForeignKey, new StringLengthAttribute(20)) .AddAttributeToMember(m => m.FkStringForeignKey, new ForeignKeyAttribute("dbo", "ManualKeyForeignTable", "ForeignKey1")); }
public void AddTypes(IPopulator populator, IList<RecordReference<ManualKeyForeignTable>> foreignSet1, IList<RecordReference<ManualKeyForeignTable>> foreignSet2) { this.tertiaryForeignSet = populator.Add<TertiaryManualKeyForeignTable>(4); this.tertiaryForeignSet[0].AddPrimaryRecordReference(foreignSet1[0]); this.tertiaryForeignSet[1].AddPrimaryRecordReference(foreignSet1[1]); this.tertiaryForeignSet[2].AddPrimaryRecordReference(foreignSet2[0]); this.tertiaryForeignSet[3].AddPrimaryRecordReference(foreignSet2[1]); this.foreignToAutoSet = populator.Add<ForeignToAutoPrimaryTable>(2); this.foreignToAutoSet[0].AddPrimaryRecordReference(this.tertiaryForeignSet[0]); this.foreignToAutoSet[1].AddPrimaryRecordReference(this.tertiaryForeignSet[1]); }
static void Main(string[] args) { var populate = PopulateFactory.GetInstance(); IPopulator brokerVisits = populate.BuildBrokerVisits(); try { brokerVisits.Populate(); Console.WriteLine("Press a key to confirm.."); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void beginPopulating() { SystemPair station = this.systems .Where((pair) => pair.Item1 == this.systemList.Text) .First(); this.populator = this.populatorFactory(station.Item2, 5, // Defaulting to 5 hours for now 30000); // Defaulting to 30 seconds because 3rd party APIs // Don't know how to set limits... // These are not constants because they will likely be // user defined in the very near future. this.populating = true; this.populator.start(); this.populator.OnSecurityUpdate += addSecurity; this.statusLabel.Text = String.Format(runningStatusMessage, station.Item1, station.Item2); this.runButton.Text = runningButtonText; }
private static void PrimaryKeyForeignKeyTest(IPopulator populator, ICodeGeneratorIntegration codeGeneratorIntegration) { IList<RecordReference<ManualKeyPrimaryTableClass>> primaries = populator.Add<ManualKeyPrimaryTableClass>(2); IList<RecordReference<ManualKeyForeignTable>> foreignSet1 = populator.Add<ManualKeyForeignTable>(2); foreignSet1.ToList().ForEach(f => f.AddPrimaryRecordReference(primaries[0])); IList<RecordReference<ManualKeyForeignTable>> foreignSet2 = populator.Add<ManualKeyForeignTable>(2); foreignSet2.ToList().ForEach(f => f.AddPrimaryRecordReference(primaries[1])); codeGeneratorIntegration.AddTypes(populator, foreignSet1, foreignSet2); primaries[0].Set(o => o.ADecimal, 112233.445566m).Set(o => o.AString, "AAXX").Set(o => o.Key1, "HummHummHumm"); foreignSet2[1].Set(o => o.ALong, 11111L).Set(o => o.AShort, (short) 1234); using (var transactionScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted})) { populator.Bind(); //transactionScope.Complete(); } Helpers.Dump(primaries); Helpers.Dump(foreignSet1); Helpers.Dump(foreignSet2); codeGeneratorIntegration.Dump(); Console.WriteLine(); Console.WriteLine(foreignSet1[0].RecordObject.ForeignKey1); Console.WriteLine(foreignSet1[1].RecordObject.ForeignKey1); Console.WriteLine(foreignSet2[0].RecordObject.ForeignKey1); Console.WriteLine(foreignSet2[1].RecordObject.ForeignKey1); }
/// <summary> ///Check if the plugins have been selected by the user, if not the revelant exceptions are thrown ///asking the user to make a choice. ///So, if the populator,evaluators, geneticOperator and terminator choices are not chosen, then ///error messages are displayed to alert the user, that the choices for these four plugins cannot be null. ///If the plugins are chosen, the engine object is created according to the user choices and it is initialised. ///Once the engine is initialised, the rest of the buttons on the interface are activated and the fitness values ///are displayed. /// </summary> private void initEngineButton_Click(object sender, EventArgs e) { if (!engineRunning) { SetEngineRunning(true); populator = null; evaluator = null; geneticOperator = null; terminator = null; outputter = null; generationFactory = null; string errorMsg = ""; if (cbPopulator.SelectedItem == null) errorMsg += "Populator must not be null\n"; else { string choice = getChoice(populators, cbPopulator); try { populator = (IPopulator)loader.GetInstance(choice, (object)tbMapFile.Text); } catch (GeneticEngineException exception) { MessageBox.Show(exception.Message); } } if (cbEvaluator.SelectedItem == null) errorMsg += "Evaluator must not be null\n"; else { string choice = getChoice(evaluators, cbEvaluator); try { evaluator = (IEvaluator)loader.GetInstance(choice, null); } catch (GeneticEngineException exception) { MessageBox.Show(exception.Message); } } if (cbGeneticOperator.SelectedItem == null) errorMsg += "Genetic Operator must not be null\n"; else { string choice = getChoice(geneticOperators, cbGeneticOperator); try { geneticOperator = (IGeneticOperator)loader.GetInstance(choice, null); } catch (GeneticEngineException exception) { MessageBox.Show(exception.Message); } } if (cbTerminator.SelectedItem == null) errorMsg += "Terminator must not be null\n"; else { string choice = getChoice(terminators, cbTerminator); if ((int)targetFitness.Value == 0) errorMsg += "Provide a target fitness value greater than 1 for the terminator plug-in\n"; else { try { terminator = (ITerminator)loader.GetInstance(choice, (object)(uint)targetFitness.Value); } catch (GeneticEngineException exception) { MessageBox.Show(exception.Message); } } } if (cbOutputter.SelectedItem != null) { string choice = getChoice(outputters, cbOutputter); if (choice != noOutputterString) { if (tbOutputFile.Text == "") { MessageBox.Show("Select an output file for the outputter\n"); } else { outputter = (IOutputter)loader.GetInstance(choice, (object)tbOutputFile.Text); } } } if (cbGenerationFactory.SelectedItem != null) { string choice = getChoice(generationFactories, cbGenerationFactory); if (choice != defaultGenerationFactoryString) { generationFactory = (IGenerationFactory)loader.GetInstance(choice, null); } } if (errorMsg != "") MessageBox.Show(errorMsg + "Please make sure you have selected a populator, evaluator, genetic operator and terminator and then try pressing the button again\n"); else { try { displayOutputter = new DisplayOutputter(this, outputter); engine = new GeneticEngine(populator, evaluator, geneticOperator, terminator, displayOutputter, generationFactory); hasInitialised = true; } catch (GeneticEngineException ex) { MessageBox.Show(ex.Message); } } SetEngineRunning(false); } }
/// <summary> /// Use <paramref name="appDomain" /> to populate an <see cref="Unity.IUnityContainer" /> /// </summary> /// <param name="appDomain">Custom <see cref="UnityContainerAttributeRegistration.Adapter.IAppDomainAdapter" /></param> public UnityContainerPopulator([NotNull] IAppDomainAdapter appDomain) { this.appDomain = appDomain; TypePopulator = new TypePopulator(appDomain); }