{"action":"created","issue":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/171","labels_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/171/comments","events_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/171/events","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/171","id":127648170,"number":171,"title":"Injecting parameters does not re-read the values, making the feature invalid","user":{"login":"godrose","id":7791651,"avatar_url":"https://avatars.githubusercontent.com/u/7791651?v=3","gravatar_id":"","url":"https://api.github.com/users/godrose","html_url":"https://github.com/godrose","followers_url":"https://api.github.com/users/godrose/followers","following_url":"https://api.github.com/users/godrose/following{/other_user}","gists_url":"https://api.github.com/users/godrose/gists{/gist_id}","starred_url":"https://api.github.com/users/godrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godrose/subscriptions","organizations_url":"https://api.github.com/users/godrose/orgs","repos_url":"https://api.github.com/users/godrose/repos","events_url":"https://api.github.com/users/godrose/events{/privacy}","received_events_url":"https://api.github.com/users/godrose/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-01-20T10:11:47Z","updated_at":"2016-01-22T11:38:04Z","closed_at":null,"body":"Hi guys.\r\nI'm trying to add the \"injection with parameters\" functionality to the container. This is useful in the specific scenario so let's just assume that this is a valid request.\r\nI implemented the **IDependencyInjectionBehavior**. \r\nThis worked for single resolution but then I tried to resolve collection of dependencies and they all got the same value for the injected parameter. \r\nAfter some investigation I discovered that the **BuildExpression** method of the aforementioned interface was called only **once** and not for each resolution as I had hoped.\r\nThe dependency itself is registered in the transient lifetime style.\r\nIs this behavior by design? Can it be altered somehow? Thanks in advance."},"comment":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/comments/173892922","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/171#issuecomment-173892922","issue_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/171","id":173892922,"user":{"login":"godrose","id":7791651,"avatar_url":"https://avatars.githubusercontent.com/u/7791651?v=3","gravatar_id":"","url":"https://api.github.com/users/godrose","html_url":"https://github.com/godrose","followers_url":"https://api.github.com/users/godrose/followers","following_url":"https://api.github.com/users/godrose/following{/other_user}","gists_url":"https://api.github.com/users/godrose/gists{/gist_id}","starred_url":"https://api.github.com/users/godrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godrose/subscriptions","organizations_url":"https://api.github.com/users/godrose/orgs","repos_url":"https://api.github.com/users/godrose/repos","events_url":"https://api.github.com/users/godrose/events{/privacy}","received_events_url":"https://api.github.com/users/godrose/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T11:38:04Z","updated_at":"2016-01-22T11:38:04Z","body":"@TheBigRic  Thanks a lot for the response.\r\nBasically you're suggesting to use Property Setter over Constructor Injection for the View Model Wrappers. This will work but I don't think it's the best solution.\r\nPlease pay attention that I never mentioned injecting dependencies into models.\r\nI think that we might have different understanding as to the role of the Model and View Model in the MVVM. \r\nI believe that Model has certain scope and responsibilities, among them validation and editing state. These responsibilities have nothing to do with the Presentation (View) of this Model. After all it doesn't matter how I present the data. If my model is a battleship , would it matter if I present it as a rich shape or a block of text? Would it influence the operations that are defined over it? Not at all. \r\nSo in my design the Model is the central layer of the Client App. Still I'm not talking about injecting dependencies into the models. \r\nAs to validation there are two kinds of error sources: client-side validation and server-side validation.\r\nThe latter would be yielded, if any, by server responses, but the former are pure client responsibilities and do not require any server response.\r\nThe View Models are merely abstractions of Views. Nothing more nothing less. This means that they expose Properties and Commands. Nothing more nothing less.\r\nThis approach has proven to work for me in several large real-world apps , with great results as well.\r\nI would love to see piece of code with different approach and how it addresses all the aforementioned issues. \r\n\r\nAnyway, any such abstract factory would still be some sort of Service Locator, with or without parameters.\r\nSo it's either creating the View Models explicitly (just assume there is a need in the View Model) or resolving them in the run-time, with or without parameters.\r\n\r\n"}}