-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Nasha
Message 1 in Discussion

  
Hi Group,

Today we will implement Role based Security in COM+ Components

Before we go ahead there have been a lot of times when I have been approached 
with these questions: - 

a) How do we start a transaction on COM+?
        In COM+ transaction is implicitly started for all the methods, which 
are present in the serviced component. There is no way to explicitly start the 
transaction like begin trans etc.

b) What type of methods should be present in COM+ components?
        Only those methods that change data should be kept in serviced 
components. Methods that only retrieve data like GetEmployeeList etc. should 
not be placed in serviced components.

c) Is using AutoComplete good?
        Yes. But provided you have done a robust error handling and u are sure 
to complete your transaction. If not go in for the SetComplete and SetAbort 
style ... I know its a little old fashioned but it is robust.

d) If there are two methods in a serviced class say method A and method B and 
from A there is a call to B then should I call SetComplete from B?
        Yes. We should always remember that COM+ and MTS works on a two phase 
commit protocol hence every operation has to acknowledge whether it was a 
success or a failure. Hence all the methods need to either call SetAbort or 
SetComplete.

Enabling Role-based security: -

To enable Role - based Security in our COM+ Components .NET Framework provides 
us with ContextUtil.IsCallerRole() method. This method authenticates the 
current user with a Windows 2000 user group and returns a boolean value.

E.g. To validate whether the current user is a part of  a windows user group 
"DotNet"

        If(ContextUtil.IsCallerInRole("DotNet") == true)
        {
                // to perform the required operation
        }

Add the above code to our Manager classes so that only those users, which 
belong to the Dot Net user group, will be able to update employee' s details.

We can also check whether the called component has an existing transaction or 
not.

To check whether the called component is in transaction or not .NET framework 
provides us with ContextUtil.IsInTransaction() method.

e.g. To check whether there is an existing transaction or not

        If(ContextUtil.IsInTransaction == false)
        {
                // Perform the required action
        }  
I m through with COM+ Services. If there is any thing that you want me to 
discuss pls mail it to me. Please do mail or post ur feedback and comments. 
-- Please post your queries and comments for my articles in the user group for 
the benefit of all. I hope this step from my end is helpful to all of us. You 
can find all articles written by me at my personal blog 
http://spaces.msn.com/members/nasha. 

Regards,

Namratha (Nasha) 
[EMAIL PROTECTED]

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to