If you can alter the table model, another option is to have a linking
table for each other entity requiring Notizes, e.g. ProjectNotiz(id,
projectid, notizid).

One thing I don't like about the current tables is that you can't
create proper foreign key constraints for the Notiz.ForeignKey column.

Maybe this helps:
http://stackoverflow.com/questions/657056/fluent-nhibernate-hasmany-withkeycolumnname

/Oskar


2009/11/28 Peter Forstmeier <[email protected]>:
> Hi List,
> the FNH List told me to ask my question here:
>
> I have a Domain 'Notiz' and some other Domain's like
> Project,Customer,Product etc. Each of this domains can have zero to
> many 'Notizen.
> Here is the mapping of Notiz:
> public NotizMapping()
>                {
>                        Id(x => x.Id).GeneratedBy.GuidComb();
>                        Map(x => x.Created);
>                        Map(x => x.Modified);
>                        Map(x => x.Betreff).Length(100);
>            Map(x => x.Text).Length(3000);
>            Map(x => x.Foreignkey);   !!!!!!!!!!! Foreign key to
> other
> Domains.
>                }
>
> and one other:
> public CustomerMapping()
>                {
>                        Id(x => x.Id).GeneratedBy.GuidComb();
>                        Map(x => x.Created);
>                        Map(x => x.Modified);
>                        Map(x => x.CustomerNumber);
>                        References(x => x.Adress).Not.Nullable
> ().Cascade.All();
>                        HasMany(x => x.Notizen)
>                                .Cascade.All();
>                }
> now. fluent nhibernate creates a DataTable like this:
>  create table "Notiz" (
>        Id UNIQUEIDENTIFIER not null,
>       Created DATETIME,
>       Modified DATETIME,
>       Betreff TEXT,
>       Text TEXT,
>       Foreignkey UNIQUEIDENTIFIER, <- just need a field to enter Key
> to other Domain
>
>
>       Customer_id UNIQUEIDENTIFIER, <- don't like this
>       Project_id UNIQUEIDENTIFIER, <- don't like this
>
>
>       Employee_id UNIQUEIDENTIFIER, <- don't like this
>
>
>       primary key (Id)
>    )
>
>
> Any idea's
> Thanks
> Peter
>
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "nhusers" 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/nhusers?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.


Reply via email to