Okay, but what should it be? What is the actual table structure?

There's definitely a system_id column on table Suscriptor that is a foreign
key to something; the CREATE statements for the tables will help us a bit
more.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of oreo
Sent: 20 October 2010 02:41 PM
To: Castle Project Users
Subject: Re: error cascade delete

whit

[BelongsTo("system_id")]
        public virtual Sistema Sistema
        {
            get { return sistema; }
            set { sistema = value; }
        }
the error is the same

On 20 oct, 14:34, Nicholas Kilian <[email protected]>
wrote:
> The column name you used in your mapping, and the column name returned 
> in the error aren't the same...
>
> column 'system_id' vs [BelongsTo("Id_Sistema")]
>
>
>
>
>
>
>
> -----Original Message-----
> From: [email protected]
>
> [mailto:[email protected]] On Behalf Of oreo
> Sent: 20 October 2010 02:28 PM
> To: Castle Project Users
> Subject: Re: error cascade delete
>
> Inhttp://stw.castleproject.org/Active%20Record.Mappings.ashxsays:
>
> If you need to delete child objects when deleting a parent (e.g. when 
> calling Blog.Delete() should also delete all related Post records from 
> the database), you can specify Inverse=true.
>
> I also tried without inverse and does not work
>
> On 20 oct, 14:17, Nicholas Kilian <[email protected]>
> wrote:
> > Why have you set Inverse=True on public virtual IList<Suscriptor> 
> > Suscriptores?
>
> > -----Original Message-----
> > From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of oreo
> > Sent: 20 October 2010 01:45 PM
> > To: Castle Project Users
> > Subject: Re: error cascade delete
>
> > I want to delete a parent, and therefore all his children.
>
> > On 20 oct, 13:35, Patrick Steele <[email protected]> wrote:
> > > If you want the parent (and all children) deleted when a single 
> > > child is deleted, just call your delete on the parent (instead of 
> > > calling delete on the child):
>
> > > child.Sistema.Delete();
>
> > > ---
> > > Patrick Steelehttp://weblogs.asp.net/psteele
>
> > > On Wed, Oct 20, 2010 at 6:59 AM, oreo <[email protected]> wrote:
> > > > Hello. Sorry for my English.
> > > > I have a one to many, and I want to delete the parent when the 
> > > > child is deleted.
>
> > > > When I try to delete a parent get the following error:
>
> > > > DELETE statement conflicted with the REFERENCE constraint 
> > > > "FK58D3BC2BC5838F81." The conflict has appeared in the database 
> > > > "NHibernate" table "dbo.Suscriptor", column 'system_id'.
> > > > Statement has been terminated.
>
> > > > [ActiveRecord]
> > > >    class Sistema : ActiveRecordBase<Sistema>
> > > >    {
> > > >        private int id;
>
> > > >        private IList<Suscriptor> suscriptores = new 
> > > > List<Suscriptor>();
>
> > > >        public Sistema()
> > > >        {
> > > >        }
>
> > > >        [PrimaryKey("Id_Sistema")]
> > > >        public virtual int Id
> > > >        {
> > > >            get { return id; }
> > > >            set { id = value; }
> > > >        }
>
> > > >        [HasMany(Cascade = 
> > > > ManyRelationCascadeEnum.AllDeleteOrphan,
> > > > Inverse=true)]
> > > >        public virtual IList<Suscriptor> Suscriptores
> > > >        {
> > > >            get { return suscriptores; }
> > > >            set { suscriptores = value; }
> > > >        }
> > > >    }
>
> > > >    [ActiveRecord]
> > > >    class Suscriptor : ActiveRecordBase<Suscriptor>
> > > >    {
> > > >        private int id;
> > > >        private Sistema sistema;
>
> > > >        public Suscriptor()
> > > >        {
> > > >        }
>
> > > >        [PrimaryKey]
> > > >        public virtual int Id
> > > >        {
> > > >            get { return id; }
> > > >            set { id = value; }
> > > >        }
>
> > > >        [BelongsTo("Id_Sistema")]
> > > >        public virtual Sistema Sistema
> > > >        {
> > > >            get { return sistema; }
> > > >            set { sistema = value; }
> > > >        }
> > > >    }
>
> > > > Thanks
>
> > > > --
> > > > You received this message because you are subscribed to the 
> > > > Google
> > Groups "Castle Project Users" group.
> > > > To post to this group, send email to
> > [email protected].
> > > > To unsubscribe from this group, send email to
> > [email protected].
> > > > For more options, visit this group
> > athttp://groups.google.com/group/castle-project-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google 
> > Groups "Castle Project Users" group.
> > To post to this group, send email to
> [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> athttp://groups.google.com/group/castle-project-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google 
> Groups "Castle Project Users" group.
> To post to this group, send email to
[email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
athttp://groups.google.com/group/castle-project-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to