I'm not sure if there's an easy way to do this. You could try using
<join>/WithTable, but I'm fairly sure that'll get upset if you have multiple
schools using the same SchoolSystem record. Personally, I'd reevaluate your
entity design. It sounds like it should just be a many-to-one/References.

On Wed, May 27, 2009 at 1:18 AM, John <[email protected]> wrote:

>
> I'm not sure how I would do this.  Any help would be appreciated.
> Basically I am trying to create a mapping for 2 tables to create 1
> entity called School.  Below are the table schemas and my entity im
> trying to map to.  SchoolSystemID is not unique.  Meaning each School
> can have one SchoolSystem and a SchoolSystem can belong to multiple
> Schools.
>
>
> -----------------------------------------------------------------------------------------
>
> CREATE TABLE [dbo].[School](
>        [SchoolID] [int] IDENTITY(1,1) NOT NULL,
>        [SchoolSystemID] [int] NOT NULL,
>        [SchoolName] [varchar](50) NOT NULL,
> )
> GO
> ALTER TABLE [dbo].[School]  WITH CHECK ADD FOREIGN KEY
> ([SchoolSystemID])
> REFERENCES [dbo].[SchoolSystem] ([SchoolSystemID])
>
>
> -------------------------------------------------------------------------------------------
>
> CREATE TABLE [dbo].[SchoolSystem](
>        [SchoolSystemID] [int] IDENTITY(1,1) NOT NULL,
>        [CountyName] [varchar](50) NOT NULL,
>        [SchoolSystemName] [varchar](50) NOT NULL,
> )
> ALTER TABLE [dbo].[SchoolSystem]  WITH CHECK ADD FOREIGN KEY
> ([CountyName])
> REFERENCES [dbo].[County] ([CountyName])
>
>
> -------------------------------------------------------------------------------------------
>
> public class School
> {
>  public virtual int ID { get; set; }
>  public virtual string Name { get; set; }
>  public virtual string CountyName { get; set; }
> }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to