aha!
found out about SetAttribute.
So it became
JoinedSubClass<ComponentNode<BasicContentComponent>>(
"NodeId",
x => x.Component<BasicContentComponent>(
b => b.Component,
c =>
{
c.Map(b => b.Title)
.WithLengthOf(256);
c.Map(b => b.Description)
.WithLengthOf(1024);
c.Map(b => b.Body)
.WithLengthOf(1024*1024);
}
))
.SetAttribute("table", "BasicContent");
and
Map(x => x.Path)
.CanNotBeNull()
.WithLengthOf(nameMaxLength*maxDepth)
.SetAttribute("unique", "true");
which is a bit "late-bound" but works for me :)
Just have to find out how to reach into the inner parts of HasMany, so
I can name the foreign key
On Sep 28, 4:20 pm, Jan Limpens <[EMAIL PROTECTED]> wrote:
> Hey folks,
>
> First of all I want to express how much I do enjoy your framework, it
> is very nice to use!
>
> I have the following mapping and a few questions to it:
>
> TableName = "Nodes";
>
> Map(x => x.Name)
> .CanNotBeNull()
> .Access.AsCamelCaseField()
> .WithLengthOf(nameMaxLength);
>
> Question: How an I make Name unique?
>
> HasOne(x => x.Parent)
> .WithForeignKey("parent_id");
>
> HasMany<Node>(x => x.Children)
> .Cascade.AllDeleteOrphan()
> .WithKeyColumn("parent_id");
>
> Question: Can I name the created Foreign Key (not the column)? Same
> goes for the pk. Currently I have
> PK__Nodes__15502E78 and FK2F6A097B38DBEDE4, which are quite sub
> optimal names and makes updates difficult.
>
> JoinedSubClass<ComponentNode<BasicContentComponent>>(
> "NodeId",
> x => x.Component<BasicContentComponent>(
> b => b.Component,
> c =>
> {
> c.Map(b => b.Title);
> c.Map(b => b.Description);
> c.Map(b => b.Body);
> }
> ));
>
> How can I define which name the subclass table shall receive?
> Currently it tries to
> create table ComponentNode`1 (...)
> and at least mssql chokes on that name. I don't find it too beautiful
> either :). Especially this issue is a show stopper...
>
> Thanks for any help,
>
> Jan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---