Is Delete cascade possible in ravendb

Posted by user1811801 on Stack Overflow See other posts from Stack Overflow or by user1811801
Published on 2012-12-11T15:01:53Z Indexed on 2012/12/11 17:03 UTC
Read the original article Hit count: 253

Filed under:
|

Still just a starter in ravendb. I have a doubt whether raven db supports some kind of referential integrity.

Here is my doubt and work..

I have document type screens as below

public class Screens 
    {
        public String Id { get; set; }
        public String ScreenName { get; set; }
}

And Another document named RightsDeclaration as below

public class RightsDeclaration 
    {
        public RightsDeclaration()
        {
            _screenrights = new List<ScreenRight>();
        }

        public String Id { get; set; }// Role Name 
        List<ScreenRight> _screenrights;
        public List<ScreenRight> ScreenRights { get { return _screenrights; } set { _screenrights = value; } }
}

Now the screen rights class looks like below with the screen name field as below

public class ScreenRight :
    {

        public String ScreenName { get; set; }
        public Boolean Create { get; set; }
        public Boolean Read { get; set; }
        public Boolean Update { get; set; }
        public Boolean Delete { get; set; }
        public Boolean Approve { get; set; }
        public Boolean Access { get; set; }
        public Boolean Print { get; set; }
        public Boolean Email { get; set; }
}

Now first i will create some list of screens and then i assign rights for each role with mentioning what is the screen name and list of rights. up to this point everything goes fine. Now in a scenario where if i would delete the screen name in screens class but then the screen rights for that screen still exists in the rights declaration. is it possible to delete the corresponding screen rights from userrights document too? if so please mention the query or idea to do the above.. Thanks in advance..

© Stack Overflow or respective owner

Related posts about c#

Related posts about ravendb