See below... Ron Jacobs Program Manager XML Enterprise Services
-----Original Message----- From: Alan Williams [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 1:41 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Serviced Components and New() Firstly thanks to everyone who is contributing to this. This is really helpful to me and far better than anything I have found in the documentation so far. Steve, Just to clarify, I am using VB.NET and COM+ 1.0 Brent, I am concerned about your statement "This object will generally be in its initial (just instantiated state)." - are there instances when it wouldn't be in its initial state ? If so, can objects be pooled still holding their state so that another request to the object might pick up the wrong state. My main concern here is with connection strings. [Ron Jacobs] When you use object pooling, you should override the Activate method of ServicedComponent and reset the objects state to some starting point. In the Deactivate method which you should also override, you should release any client specific state prior to being returned to the pool. Generally, Should I be implementing IObjectControl as a matter of course or only if I want to capture some of the events? [Ron Jacobs] With .NET IObjectControl is implemented in ServicedComponent for you. You can selectively override these methods but you should do so only when you have a reason to. If each method (apart from Init) set EnableCommit() or DisableCommit() rather than SetComplete() or SetAbort() would my object always hold its state for future calls by the same caller without having to call Init() again. If so, would there then be any mileage in having a Dispose() method on each class that just called DeactivateOnReturn(). The Dispose() would be called on the object when it is no longer needed and then it would be deactivated and pooled. My original code example would then look like .... Dim objMyObject as New TransactionalObject() objMyObject.Init(x,y,z) For c = 1 TO n objMyObject.TransactionalMethod(.. , .. , ..) Next objMyObject.Dispose() .. or am I playing with fire here? [Ron Jacobs] You could simplify your design by passing x,y,z to the TransactionalMethod every time, or you can call DisableCommit which will cause your object to not deactivate. Then you should in some other method call SetComplete so the transaction can complete and the object can be deactivated. In general this design can cause problems if the object is not used correctly by clients so I try to avoid designs that rely on the client doing the right thing. [Ron Jacobs] Thanks again Alan -----Original Message----- From: Peter Foreman [mailto:[EMAIL PROTECTED]] Sent: 18 April 2002 19:42 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Serviced Components and New() --- Steve Holak <[EMAIL PROTECTED]> wrote: > If it's an object that maintains state, then there's no problem. If it's a > stateless COM+ component, then no. I do recommend ditching the Intit > method and initializing the property values in the constructor call : Doh! We're going round in circles. :-) > IIRC, the Init functions evolved from VB classes not supporting > parameterized constructors. I'd say COM. > Of course, if you're not talking .NET, then VB6 will not allow > parameterized constructors. Which . . . reading through the thread, you > probably are, so ignore everything . . . LOL. He's talking about COM+ Peter __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.