Hi

that ForeignKey creates a constraint named Country_ID instead of selecting
the PK of the referenced table. AFAIR it is used only to name the FK
constraint other than FK__table__table__guid. But since these are two
different constraints, each name must be named unique.

If you not intend to rename the constraint, simply remove the ForeignKey
attribute.

-Markus

2012/1/17 C#_konqueror <[email protected]>

> Hi Mauricio
>
> here is the inner exception
> {"There is already an object named 'Country_ID' in the database. Could
> not create constraint. See previous errors."}
>
> Message
> Could not create the schema
>
> StackTrace
>   at Castle.ActiveRecord.ActiveRecordStarter.CreateSchema() in c:
> \TeamCity\buildAgent\work\e41ee5ead2eba140\src\Castle.ActiveRecord
> \Framework\ActiveRecordStarter.cs:line 290
>   at MyApp.Application_Start() in D:\TR Project\Global.asax.cs:line
> 53
>
>
> On Jan 17, 12:55 pm, Mauricio Scheffer <[email protected]>
> wrote:
> > Could you post the full stack trace? Thanks.
> >
> > --
> > Mauricio
> >
>  > On Tue, Jan 17, 2012 at 1:46 AM, C#_konqueror <[email protected]>
> wrote:
> > > Hi Guys,
> >
> > > I have here 2 entities
> >
> > > let say
> >
> > > Flight
> > > flight_id - PK
> > > origin - FK1
> > > destination - FK2
> >
> > > Countries
> > > country_id - PK
> > > country
> > > code
> >
> > > sample code
> > > Class Flight
> > > {
> > >      public int ID {get; set; }
> >
> > >      [BelongsTo(Column = "Origin", ForeignKey = "country_id")]
> > >      public Countries Origin {get; set;}
> >
> > >      [BelongsTo(Column = "destination", ForeignKey = "country_id")]
> > >      public Countries Destination {get; set; }
> >
> > > }
> >
> > > I'm getting an error when creating a schema on Activerecord. What will
> > > be an alternative to this? 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 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.
>
>

-- 
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