If you new a disposable object, you should dispose that object.
If you resolve a component, you should release the component.

MyPage did not call resolve, so it should not be concerned with calling release.

If FrameworkInitialize is resolving components, then you should have a
FrameworkTeardown to release the components.

On Thu, Mar 5, 2009 at 11:28 AM, Bill Barry <[email protected]> wrote:
>
> Bill Pierce wrote:
>> Am I understanding this correctly?
>
> <snip>
>
> The trouble with this is not that it puts the onus on the developer to
> do the right thing, but rather that the wrong thing isn't obviously wrong.
>
> Suppose I have the following asp.net webform codebehind, how do I know I
> need to release IHelloService (even moreso, do I need to release it at
> all?)?:
>
> public class MyPage: BasePage {
>    public IHelloService HelloService { get; set; }
>
>    public void Page_Load(object Sender, EventArgs e) {
>        if(!IsPostBack) helloLiteral.Text = HelloService.SayHello();
>    }
> }
>
>
> where BasePage is:
> public class BasePage {
>    public override void FrameworkInitialize() {
>        this.FillDependencies();
>        base.FrameworkInitialize();
>    }
> }
>
> FillDependencies is an extension method that fills all properties
> available on the control where the property type is a service defined in
> the container.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to