HI all,
I am working on AMO and .NET.In my application i have to create a role and that i am able to do it.When i am creating a role i provided some Database and cube permissions.while dropping the role i am getting some error message is like permissions are exist on that object(ROLE).So what i did is i dropped permissions first after that i am tried to drop the role.
Still i am getting the same problem when i am dropping the permissions.I am sending that part of code which i am using in my application.
dbPerm = amodatabase.DatabasePermissions.FindByRole(RoleName)
dbPerm.Drop(DropOptions.IgnoreFailures)
cubePerm = amocube.CubePermissions.FindByRole(RoleName)
cubePerm.Drop(DropOptions.IgnoreFailures)
Newrole.Drop(DropOptions.IgnoreFailures)after dropping the role i am commiting the transaction.and i am getting below error message while deleting.
Errors in the metadata manager. The cube permission with the ID of 'CubePermission 3', Name of 'CubePermission 3' was invalidated by operations in the transaction. Errors in the metadata manager. The transaction cannot be committed because one or more objects were invalidated during the transaction
Please help me on this and correct my code.
Regards,
vishwesh
Set Newrole.Drop(DropOptions.IgnoreFailures) to Newrole.Drop(DropOptions.AlterOrDeleteDependents).
I believe you can remove the following:
dbPerm = amodatabase.DatabasePermissions.FindByRole(RoleName)
dbPerm.Drop(DropOptions.IgnoreFailures)
cubePerm = amocube.CubePermissions.FindByRole(RoleName)
cubePerm.Drop(DropOptions.IgnoreFailures)
B.
|||Hi Bryan,
I tried with the above code and executes but i am getting some strange error see below.
Errors in the metadata manager. Impact analysis inside a pending transaction cannot support CREATE, DELETE, or ALTER commands.
could you please let me know what could be the problem.
Regards,
vishweshwar
|||Could you post your revised code?
Thanks,
B.
|||Hi Bryan,
Please find the revised code.
Newrole = amodatabase.Roles.FindByName(RoleName)
If Newrole Is Nothing Then
Throw New ApplicationException("Role not exist in database")
Else
Newrole.Drop()
amodatabase.Update()
amoserver.CommitTransaction()
End IfPlease help me on this how to sort it out.
Bryan's suggestion was to use the AlterOrDeleteDependants option on the Drop method.
Newrole = amodatabase.Roles.FindByName(RoleName)
If Newrole Is Nothing Then
Throw New ApplicationException("Role not exist in database")
Else
Newrole.Drop(DropOptions.AlterOrDeleteDependents).
amodatabase.Update()
amoserver.CommitTransaction()
End If
No comments:
Post a Comment