Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if( operatorRole.AllowedOperations.Count == 0 )
- {
- operatorRole.AllowedOperations.Add( op1 );// all ops (op1-op4) are transient
- operatorRole.AllowedOperations.Add( op2 );
- }
- if (administratorRole.AllowedOperations.Count == 0)
- {
- administratorRole.AllowedOperations.Add(op1);
- administratorRole.AllowedOperations.Add(op2);
- administratorRole.AllowedOperations.Add(op3);
- administratorRole.AllowedOperations.Add(op4);
- }
- using( var session = factory.OpenSession() )
- using( var tx = session.BeginTransaction() )
- {
- session.Merge(operatorRole);
- session.Merge(administratorRole); // <-- tries to insert op1, and op2 for the 2nd time, throws on UNIQUE violation. SaveOrUpdateCopy does the same
- tx.Commit();
- }
Add Comment
Please, Sign In to add comment