public EnumerableSource(int minCount, int maxCount, object[] args) { mMinCount = minCount; mMaxCount = maxCount; mArgs = args; var factory = new DatasourceFactory(typeof(TSource)); factory.SetParams(mArgs); mSource = (IDatasource <T>)factory.Build(); }
protected override void PopulateConfiguration() { this.Configuration.RegisterType(typeof(SimpleUser)); var simpleUserConfig = this.Configuration.GetRegisteredType(typeof(SimpleUser)); var emailMember = ReflectionHelper.GetMember <SimpleUser>(x => x.EmailAddress); var firstNameMember = ReflectionHelper.GetMember <SimpleUser>(x => x.FirstName); var lastNameMember = ReflectionHelper.GetMember <SimpleUser>(x => x.LastName); simpleUserConfig.RegisterMember(emailMember); simpleUserConfig.RegisterMember(firstNameMember); simpleUserConfig.RegisterMember(lastNameMember); var emailSourceFactory = new DatasourceFactory(typeof(ValueSource)); emailSourceFactory.SetParams("*****@*****.**"); var firstNameFactory = new DatasourceFactory(typeof(ValueSource)); firstNameFactory.SetParams("first"); var lastNameFactory = new DatasourceFactory(typeof(ValueSource)); lastNameFactory.SetParams("last"); simpleUserConfig.GetRegisteredMember(emailMember).SetDatasource(emailSourceFactory); simpleUserConfig.GetRegisteredMember(firstNameMember).SetDatasource(firstNameFactory); simpleUserConfig.GetRegisteredMember(lastNameMember).SetDatasource(lastNameFactory); this.Configuration.RegisterType(typeof(SimpleFieldClass)); var simpleFieldConfig = this.Configuration.GetRegisteredType(typeof(SimpleFieldClass)); var someFieldMember = ReflectionHelper.GetMember <SimpleFieldClass>(x => x.SomeField); var someOtherField = ReflectionHelper.GetMember <SimpleFieldClass>(x => x.SomeOtherField); simpleFieldConfig.RegisterMember(someFieldMember); simpleFieldConfig.RegisterMember(someOtherField); var someFieldFactory = new DatasourceFactory(typeof(ValueSource)); someFieldFactory.SetParams("one"); var someOtherFieldFactory = new DatasourceFactory(typeof(ValueSource)); someOtherFieldFactory.SetParams("other"); simpleFieldConfig.GetRegisteredMember(someFieldMember).SetDatasource(someFieldFactory); simpleFieldConfig.GetRegisteredMember(someOtherField).SetDatasource(someOtherFieldFactory); }