Get a operations for a role

Topics: General Topic
Jan 24, 2013 at 3:39 AM

In my c# program, I need to get a list of operations for a particular role.

Also, I need to get a list of roles with a certain word in the description. 

 

Can someone help me with the appropriate methods or queries?

Thank you!

Coordinator
Jan 24, 2013 at 6:39 AM
Edited Jan 24, 2013 at 6:39 AM

Hi,

this should be help you:

 

using System.Linq;

using NetSqlAzMan;

using NetSqlAzMan.Interfaces;

 

namespace NetSqlAzManDemo

{

 class Program 

{

 static void Main(string[] args)

{

 string sqlConnectionString = "data source=(local);Initial Catalog=NetSqlAzManStorage;Integrated Security=SSPI";

using (IAzManStorage storage = new SqlAzManStorage(sqlConnectionString))

{

storage.OpenConnection();

IAzManStore store = storage.GetStore("My Store");

IAzManApplication application = store.GetApplication("My Application");

 

//1. to get a list of operations for a particular role

IAzManItem myParticularRole = application.GetItem("My Particular Role Name");

IAzManItem[] operations = (from m in myParticularRole.GetMembers()

where m.ItemType == ItemType.Operation

select m).ToArray();

 

//2. to get a list of roles with a certain word in the description

IAzManItem[] rolesWithDescription = (from t in application.GetItems(ItemType.Role)

where t.Description.Contains("foo")

select t).ToArray();

}

}

}

}

 

 

Andrea Ferendeles / NetSqlAzMan Project Coordinator 

Jan 28, 2013 at 6:09 PM

Hi Andrea,

 

Thank you for the rapid response and the perfect solutions. 

 

Both solutions were exactly what I needed.

 

Peg