Inject() public static method

public static Inject ( UnityEngine.MonoBehaviour target ) : void
target UnityEngine.MonoBehaviour
return void
        private void InjectGameObject()
        {
            injector.GameObjectDependencys.Add("test", gameObject);

            injector.Inject(compnent);

            TestRunner.ReferenceEquals(gameObject, compnent.test);
            TestRunner.ReferenceEquals(null, compnent.testClass);
        }
Example #2
0
        private void ConstructOnMonoBehaviourViaGameObject()
        {
            var newGameObj = new GameObject("GameObject");
            var comp       = newGameObj.AddComponent <Test1Compnent>();

            di.GameObjectDependencys.Add("test", newGameObj);
            di.Inject(newGameObj);

            TestRunner.Equals(true, comp.constructRun);
        }
Example #3
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     DependencyInjector.Inject(services, Configuration);
     //Adicionando AutoMapper
     services.AddAutoMapper();
     AutoMapperConfiguration.Configure();
     services.AddMvc();
 }
Example #4
0
        private static IKernel ConfigureGeneric(IKernel kernel)
        {
            IDependencyInjector injector = new DependencyInjector();

            injector.Inject(kernel);
            AutoMapperBootstrapper.Initialize(kernel);
            return(kernel);
        }
Example #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            DependencyInjector.Inject(services, Configuration);
            services.AddAutoMapper();
            AutoMapperConfiguration.Configure();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
Example #6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            DependencyInjector.Inject(services);

            var mapper = AutoMapperToDoList.GetMapperConfiguration();

            services.AddSingleton(mapper);

            services.AddControllers();
        }
Example #7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //×¢ÈëÒµÎñ²ã
            DependencyInjector.Inject(services);

            services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
            services.AddSession();
            services.AddHttpContextAccessor();
            services.AddControllersWithViews();
            services.AddMvc().AddRazorRuntimeCompilation();
        }
Example #8
0
        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            // register all your components with the container here
            // it is NOT necessary to register your controllers

            // e.g. container.RegisterType<ITestService, TestService>();
            DependencyInjector.Inject(container);
            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
            // DependencyResolver.SetResolver(new Unity.WebApi.UnityDependencyResolver(container));
        }
Example #9
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //×¢ÈëÒµÎñ²ã
            DependencyInjector.Inject(services);

            services.AddControllers().AddNewtonsoftJson();

            //services.AddControllers().AddJsonOptions(options =>
            //{
            //    options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
            //});
        }
Example #10
0
        public MainForm(IUiAction[] actions, PictureBoxImageHolder pictureBox, Palette palette)
        {
            var imageSettings = CreateSettingsManager().Load().ImageSettings;

            ClientSize = new Size(imageSettings.Width, imageSettings.Height);

            var mainMenu = new MenuStrip();

            mainMenu.Items.AddRange(actions.ToMenuItems());
            Controls.Add(mainMenu);

            pictureBox.RecreateImage(imageSettings);
            pictureBox.Dock = DockStyle.Fill;
            Controls.Add(pictureBox);

            DependencyInjector.Inject <IImageHolder>(actions, pictureBox);
            DependencyInjector.Inject <IImageDirectoryProvider>(actions, CreateSettingsManager().Load());
            DependencyInjector.Inject <IImageSettingsProvider>(actions, CreateSettingsManager().Load());
            DependencyInjector.Inject(actions, palette);
        }