protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ObjectFactory.BuildUp(this);
     }
 }
Пример #2
0
        public Statusbar()
        {
            ObjectFactory.BuildUp(this);

            InitializeComponent();

            ClearStatus();
        }
Пример #3
0
        public IJob NewJob(TriggerFiredBundle bundle)
        {
            Type jobType = bundle.JobDetail.JobType;
            var  job     = ObjectFactory.GetInstance(jobType) as IJob;

            ObjectFactory.BuildUp(job);
            return(job);
        }
Пример #4
0
        public PackageButtonsPanel()
        {
            ObjectFactory.BuildUp(this);

            InitializeComponent();

            btnUpdate.Click           += BtnUpdateClick;
            btnInstallUninstall.Click += BtnInstallUninstallClick;
        }
Пример #5
0
 public PackagesBaseGrid()
 {
     _bindingsource = new BindingSource();
     ObjectFactory.BuildUp(this);
     InitializeComponent();
     DoLayout();
     packagesGrid.DataSource = _bindingsource;
     searchButton.Click     += SearchButtonClick;
 }
Пример #6
0
 public void BuildUp(object target)
 {
     try
     {
         ObjectFactory.BuildUp(target);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #7
0
        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);
        }
Пример #8
0
        public PackageVersionPanel()
        {
            ObjectFactory.BuildUp(this);

            InitializeComponent();
            ClearPanel();

            linkGalleryDetails.LinkClicked += OnGalleryDetailsClicked;
            linkLicense.LinkClicked        += OnLiscenseClicked;
            linkProjectSite.LinkClicked    += OnProjectSiteClicked;
            linkAbuse.LinkClicked          += OnAbuseClicked;
        }
Пример #9
0
        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);
        }
Пример #10
0
        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));
            }
        }
Пример #12
0
        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");
        }
Пример #13
0
        // 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);
        }
Пример #15
0
        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");
        }
Пример #16
0
        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);
 }
Пример #19
0
 public static void BuildUp(object target)
 {
     ObjectFactory.BuildUp(target);
 }
 public BasePage()
 {
     // instruct StructureMap to resolve dependencies
     ObjectFactory.BuildUp(this);
 }
Пример #21
0
 protected BaseCommand()
 {
     ObjectFactory.BuildUp(this);
 }
 public override void RuntimeInitialize(MethodBase method)
 {
     // Initialize the SessionFactory according to the container configuration.
     ObjectFactory.BuildUp(this);
 }
Пример #23
0
 public BasePage()
 {
     ObjectFactory.BuildUp(this);
 }
Пример #24
0
 protected StructureMapPageBase()
 {
     ObjectFactory.BuildUp(this);
 }
Пример #25
0
        public PackageExtraInformationPanel()
        {
            ObjectFactory.BuildUp(this);

            InitializeComponent();
        }
Пример #26
0
 protected override void OnPreInit(EventArgs e)
 {
     ObjectFactory.BuildUp(this);
     base.OnPreInit(e);
 }
Пример #27
0
        public PackageRunPanel()
        {
            ObjectFactory.BuildUp(this);

            InitializeComponent();
        }
Пример #28
0
 public BaseApiControler()
 {
     ObjectFactory.BuildUp(this);
 }
Пример #29
0
 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
 }