{"action":"created","issue":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/198","repository_url":"https://api.github.com/repos/simpleinjector/SimpleInjector","labels_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/198/comments","events_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/198/events","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/198","id":138182405,"number":198,"title":"About Lifestyle.Transient","user":{"login":"zhshqzyc","id":7240266,"avatar_url":"https://avatars.githubusercontent.com/u/7240266?v=3","gravatar_id":"","url":"https://api.github.com/users/zhshqzyc","html_url":"https://github.com/zhshqzyc","followers_url":"https://api.github.com/users/zhshqzyc/followers","following_url":"https://api.github.com/users/zhshqzyc/following{/other_user}","gists_url":"https://api.github.com/users/zhshqzyc/gists{/gist_id}","starred_url":"https://api.github.com/users/zhshqzyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhshqzyc/subscriptions","organizations_url":"https://api.github.com/users/zhshqzyc/orgs","repos_url":"https://api.github.com/users/zhshqzyc/repos","events_url":"https://api.github.com/users/zhshqzyc/events{/privacy}","received_events_url":"https://api.github.com/users/zhshqzyc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-03T13:51:37Z","updated_at":"2016-03-03T14:10:57Z","closed_at":null,"body":"I have an telephony application. During the operation, many lines run simultaneously. Each line uses its own channel resource or voice resource. \r\n\r\n       public class VoiceElementsLine : ILine\r\n       {\r\n            public IVoiceResource IncomingChannelResource { get; set; }\r\n            public VoiceElementsLine(IVoiceResource channelElementsResource = null)\r\n            {\r\n                IncomingChannelResource = channelElementsResource;\r\n            }\r\nAnd\r\n\r\n      public class VoiceElementsResource : IVoiceResource\r\n        {\r\n            private readonly ChannelResource _channelResource;\r\n            private readonly VoiceResource _voiceResource;\r\n\r\n            public VoiceElementsResource()\r\n            {\r\n            }\r\n            public VoiceElementsResource(ChannelResource channelResource)\r\n           {\r\n                _channelResource = channelResource;\r\n                _voiceResource = _channelResource.VoiceResource;\r\n           }\r\nI register it as\r\n           `Container.Register<ILine, VoiceElementsLine>();\r\n\r\n            Container.Register<IVoiceResource>(() =>\r\n                new VoiceElementsResource()\r\n            );`\r\nMy question is can I use Lifestyle.Transient rather than new up VoiceElementsResource?\r\nSo the code will be:\r\n` Container.Register<IVoiceResource,VoiceElementsResource>(Lifestyle.Transient);`\r\nAny difference?\r\n"},"comment":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/comments/191778068","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/198#issuecomment-191778068","issue_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/198","id":191778068,"user":{"login":"qujck","id":4510990,"avatar_url":"https://avatars.githubusercontent.com/u/4510990?v=3","gravatar_id":"","url":"https://api.github.com/users/qujck","html_url":"https://github.com/qujck","followers_url":"https://api.github.com/users/qujck/followers","following_url":"https://api.github.com/users/qujck/following{/other_user}","gists_url":"https://api.github.com/users/qujck/gists{/gist_id}","starred_url":"https://api.github.com/users/qujck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qujck/subscriptions","organizations_url":"https://api.github.com/users/qujck/orgs","repos_url":"https://api.github.com/users/qujck/repos","events_url":"https://api.github.com/users/qujck/events{/privacy}","received_events_url":"https://api.github.com/users/qujck/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T14:10:57Z","updated_at":"2016-03-03T14:10:57Z","body":"It will be the same for your example. \r\n\r\n```csharp\r\ncontainer.Register<IVoiceResource>(() => new VoiceElementsResource());\r\n```\r\nis the same as\r\n```csharp\r\ncontainer.Register<IVoiceResource, VoiceElementsResource>(Lifestyle.Transient);\r\n```\r\nis the same as \r\n```csharp\r\ncontainer.Register<IVoiceResource, VoiceElementsResource>();\r\n```"}}