IAzRolesLib from .NET 2.0

Hi,

I'm trying to use IazRolesLib from .NET 2.0.

The DeleteScope() works BUT the scope is not deleted immediately.

In VB6 it works find

I have a program that demonstrates the problem. One button is used to create the scope and the other button is used to delete. When clicking Create, Delete and then Create again an exception is return that the scope is already exist

I'll appreciate help as soon as possible

Thanks Gil

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AZROLESLib;

namespace WindowsApplication31
{
public enum AzmanStoreFlags
{
AZ_AZSTORE_FLAG_MANAGE_STORE_ONLY = 2,
AZ_AZSTORE_FLAG_BATCH_UPDATE = 4
};
public partial class Form1 : Form
{
private AzAuthorizationStore store;

public Form1()
{
InitializeComponent();
store = new AzAuthorizationStoreClass();
store.Initialize((int)AzmanStoreFlags.AZ_AZSTORE_FLAG_MANAGE_STORE_ONLY | (int)AzmanStoreFlags.AZ_AZSTORE_FLAG_BATCH_UPDATE, "msxml://c:\\temp\\tmsroles.xml", null);
}

private void button1_Click(object sender, EventArgs e)
{
try
{
IAzApplication app = (IAzApplication)store.Applications[1];
MessageBox.Show(Convert.ToString(app.Scopes.Count));
IAzScope scope = app.CreateScope("test", null);
scope.Submit(0, null);
app.Submit(0, null);
store.Submit(0, null);
store.UpdateCache(null);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}

private void button2_Click(object sender, EventArgs e)
{
try
{
IAzApplication app = (IAzApplication)store.Applications[1];
MessageBox.Show(Convert.ToString(app.Scopes.Count));
app.DeleteScope("test", null);
app.Submit(0, null);
store.Submit(0, null);
MessageBox.Show(Convert.ToString(app.Scopes.Count));
store.UpdateCache(null);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
}
}


[2982 byte] By [GilFefer] at [2007-12-22]