Dec 12, 2009 at 12:06 PM

HI Andrea,

I was wondering if there is a simple way to get the hierarchy from a IAzManItem.

Let's say for exemple that I retreived a Role, i want to programmatically retreive the inner roles of this role.

Thks for your support.


Dec 12, 2009 at 3:25 PM

Sorry for the stupid question, GetMembers will give me the inner roles.

Now how do i select the roots roles nodes ?


Dec 14, 2009 at 8:26 PM

If you use a recursive algorithm … just preserve the root Item into a variable.


Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com

Dec 14, 2009 at 11:55 PM

Hi Andrea,

I will give you a little more info on what exaclty i'm doing.

I'm using the NetSqlAzManRoleProvider (more exact a sub class of NetSqlAzManRoleProvider). In my WCF web application, I want to present the user with a Treeview representation of the Azman hierarchy, but i don't want to build the hierarchy all in once,a nd i also don't want to use session mechanism temporarly store the items.

So the first step is to be able to select the root node.

What i'm doing is the following:

Using the name of the role as a Key parameter of a SelectNodes(string name) function.

If the name is null, use provider.Application.GeItems(ItemType.Role) where ItemsWhereIAmMember.Count == 0. This gives me the root nodes.

If the name is not null, use provider.Application.GetItem(name) and gets the children using item.GetMembers()

Question 1 : Is this the correct way of doing things ?

Question 2: Now i want to give the users the ability to modify the hierarchy (CRUD operation on nodes). Should i define and commit a transaction (provider.Storage.BeginTransacation, CommitTransaction) before modifying the hierarchy or this not necessary ?

Question 3 : I realized that the routine explained in question 1, is not working anymore if i open the AzMan Management Console and modify the name of a role for example. The code will give me an error saying that the Key is not in the dictionnary. I beleive it is because the RoleProvider is using cache. How can the cache mechanism be bypassed when using your role provider ? Can this feature be an attribute of the config section (in web.config). Something like useCache = "false"



Dec 15, 2009 at 8:34 PM

Hi Avi,


1)      Yes, is correct.

2)      Not necessary. If you are in a Request/Response environment (like a WCF web application) you cannot leave open a transaction for a long time.

3)      NetSqlAzMan use internally a cache. If you want, you can erase this cache calling NetSqlAzManRoleProvider.Initialize(…) method. No other way.






Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com