protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ObjectFactory.BuildUp(this); } }
public Statusbar() { ObjectFactory.BuildUp(this); InitializeComponent(); ClearStatus(); }
public IJob NewJob(TriggerFiredBundle bundle) { Type jobType = bundle.JobDetail.JobType; var job = ObjectFactory.GetInstance(jobType) as IJob; ObjectFactory.BuildUp(job); return(job); }
public PackageButtonsPanel() { ObjectFactory.BuildUp(this); InitializeComponent(); btnUpdate.Click += BtnUpdateClick; btnInstallUninstall.Click += BtnInstallUninstallClick; }
public PackagesBaseGrid() { _bindingsource = new BindingSource(); ObjectFactory.BuildUp(this); InitializeComponent(); DoLayout(); packagesGrid.DataSource = _bindingsource; searchButton.Click += SearchButtonClick; }
public void BuildUp(object target) { try { ObjectFactory.BuildUp(target); } catch (Exception) { throw; } }
protected override IEnumerable <FilterAttribute> GetActionAttributes(ControllerContext controllerContext, ActionDescriptor actionDescriptor) { IEnumerable <FilterAttribute> filters = base.GetActionAttributes(controllerContext, actionDescriptor); foreach (FilterAttribute filter in filters) { ObjectFactory.BuildUp(filter); } return(filters); }
public PackageVersionPanel() { ObjectFactory.BuildUp(this); InitializeComponent(); ClearPanel(); linkGalleryDetails.LinkClicked += OnGalleryDetailsClicked; linkLicense.LinkClicked += OnLiscenseClicked; linkProjectSite.LinkClicked += OnProjectSiteClicked; linkAbuse.LinkClicked += OnAbuseClicked; }
public IEnumerable <Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) { IEnumerable <Filter> filters = base.GetFilters(controllerContext, actionDescriptor); foreach (Filter filter in filters) { // Injects the instance with Structuremap's dependencies Log.Information(filter.Instance.GetType().Name); ObjectFactory.BuildUp(filter.Instance); } return(filters); }
public int AddTask(IBackgroundTask task) { int id = ++_id; Tasks[id] = task; Task.Run(() => { ObjectFactory.BuildUp(task); task.DoTask(); }); return(id); }
public override IController CreateController(RequestContext requestContext, string controllerName) { try { var controllerType = base.GetControllerType(requestContext, controllerName); var controller = ObjectFactory.GetInstance(controllerType) as IController; ObjectFactory.BuildUp(controller); return(controller); } catch (Exception ex) { Logger.InfoException("Default controller logic is being used.", ex); //Use the default logic.); return(base.CreateController(requestContext, controllerName)); } }
public void Test() { ObjectFactory.Initialize(x => { x.ForConcreteType <SomeDbRepository>().Configure. Ctor <string>("connectionString").Is("some connection string"); //x.ForConcreteType<SomeWebPage>().Configure. // SetterDependency<SomeDbRepository>().Is<SomeDbRepository>(); x.Policies.SetAllProperties(o => o.OfType <SomeDbRepository>()); }); var webPage = new SomeWebPage(); ObjectFactory.BuildUp(webPage); webPage.DbRepository.ConnectionString.ShouldEqual("some connection string"); }
// WebApi public IEnumerable <System.Web.Http.Filters.FilterInfo> GetFilters(HttpConfiguration configuration, HttpActionDescriptor actionDescriptor) { if (_webApiProviders != null) { IEnumerable <System.Web.Http.Filters.IFilterProvider> filterProviders = _webApiProviders; IEnumerable <System.Web.Http.Filters.FilterInfo> filters = filterProviders.SelectMany(x => x.GetFilters(configuration, actionDescriptor)).ToList(); foreach (System.Web.Http.Filters.FilterInfo filter in filters) { // Injects the instance with Structuremap's dependencies Log.Information(filter.Instance.GetType().Name); ObjectFactory.BuildUp(filter.Instance); } return(filters); } else { // _webApiProviders will be null for something return(null); } }
public void create_a_setter_rule_and_see_it_applied_in_BuildUp_through_ObjectFactory() { var theGateway = new DefaultGateway(); ObjectFactory.Initialize(x => { x.For <IGateway>().Use(theGateway); // First we create a new Setter Injection Policy that // forces StructureMap to inject all public properties // where the PropertyType is IGateway x.Policies.SetAllProperties(y => { y.OfType <IGateway>(); }); }); // Create an instance of BuildUpTarget1 var target = new BuildUpTarget1(); // Now, call BuildUp() on target, and // we should see the Gateway property assigned ObjectFactory.BuildUp(target); target.Gateway.ShouldBeTheSameAs(theGateway); }
public void Test() { ObjectFactory.Initialize(x => { x.UseDefaultStructureMapConfigFile = false; x.ForConcreteType <SomeDbRepository>().Configure. WithCtorArg("connectionString").EqualTo("some connection string"); //x.ForConcreteType<SomeWebPage>().Configure. // SetterDependency<SomeDbRepository>().Is<SomeDbRepository>(); x.SetAllProperties(o => o.OfType <SomeDbRepository>()); }); var dbRepository = ObjectFactory.GetInstance <SomeDbRepository>(); var webPage = new SomeWebPage(); ObjectFactory.BuildUp(webPage); webPage.DbRepository.ConnectionString.ShouldEqual("some connection string"); }
public override object GetResult() { DataTable dt = DataFactory.GetResult() as DataTable; List <T> result = new List <T>(); T obj; IFactory objFactory = new ObjectFactory(); Type objectType = typeof(T); foreach (DataRow dr in dt.Rows) { obj = objFactory.BuildUp <T>(); AttributeHelper.GetProperty(objectType, TableAttr.PrimaryKeyInfo.PropertyName).SetValue(obj, dr[TableAttr.PrimaryKeyInfo.FieldName]); foreach (var mapInfo in TableAttr.Maps) { if (dr[mapInfo.Value.FieldName] is DBNull) { continue; } objectType.GetProperty(mapInfo.Value.PropertyName).SetValue(obj, dr[mapInfo.Value.FieldName], null); } result.Add(obj); } return(result); }
public MyControl() { this.InitializeComponent(); ObjectFactory.BuildUp(this); }
protected DependencyUserControl() { ObjectFactory.BuildUp(this); }
public static void BuildUp(object target) { ObjectFactory.BuildUp(target); }
public BasePage() { // instruct StructureMap to resolve dependencies ObjectFactory.BuildUp(this); }
protected BaseCommand() { ObjectFactory.BuildUp(this); }
public override void RuntimeInitialize(MethodBase method) { // Initialize the SessionFactory according to the container configuration. ObjectFactory.BuildUp(this); }
public BasePage() { ObjectFactory.BuildUp(this); }
protected StructureMapPageBase() { ObjectFactory.BuildUp(this); }
public PackageExtraInformationPanel() { ObjectFactory.BuildUp(this); InitializeComponent(); }
protected override void OnPreInit(EventArgs e) { ObjectFactory.BuildUp(this); base.OnPreInit(e); }
public PackageRunPanel() { ObjectFactory.BuildUp(this); InitializeComponent(); }
public BaseApiControler() { ObjectFactory.BuildUp(this); }
protected void Page_Load(object sender, EventArgs e) { ObjectFactory.BuildUp(this); this.Do_Load(sender, e); //template method, to enable subclasses to mimic "Page_load" event }