>
> Hi Pete,
>

Man that's a Big Email:

Ok Here we go:

1.1 Is it possible to change the foreign key relationship names so
>
they're like FK_{tablename}_{FK_tablename} ?  At the moment, these
>
keys are non-human-readable strings like FK76553BBAAD1ED7F4 (I guess
>
this is a hash?).


I'm guessing you using fluentNhibernate to generate your db diagram, in
which case these are set by nhibernate it self. I personally don't know a
way of changing that, but someone more nhibernate experienced may
know differently.

1.2 Can I pluralize table-names somehow?


Not at the moment, but I would love to add this functionality. If anyone can
think of/or know's of a decent way to pluralize words without me doing
personally that would be a great help.

1.3 I have some enums as entity properties - what happens to these?
>
Can those be mapped to tables and automatically populated as foreign-
>
key relationships, so they're in the DB for a DBA to understand if he
>
needs to?  If this is possible, can I specify that the schema for this
>
dictionary data be different from the schema for other tables?
>

Automapping will at the moment ignore your enums, but you should be able to
map the enum's using the ForTypesThatDeriveFrom<> Method, there are some
discussions over this in the group you could search for. Personally I tend
to map them to a class, but I know some people map to an enum,

1.4 The PersistenceModel.WriteMappings(foldername) method doesn't
>
appear to do anything...?  I was expecting it to write out the XML for
>
the mapping files to a folder (I used c:\\), but nothing appeared (I
>
don't think permissions are an issue).


I've no idea on this one, does someone who knows the main section of the
code able to answer this?


> 1.5 Can I order the table-columns such that the primary key comes
>
first, then all the foreign keys, then everything else?
>

I'm a bit confused as to why you would want to do this? Plus I'm not sure
you can without setting specific nhibernate commands to execute. Can anyone
else contribute to how you could or would want to do this?

1.6 I Guess constraints, defaults, and cascades are mapped via
>
SetAttribute - am I right to think that this method sets the
>
attributes on what will be the class node of the hbm mapping?  Perhaps
>
this could be renamed to SetClassAttribute?
>

SetAttribute is usually used to apply attributes when it's not yet been
implemented by fluentNhibernate. For example:

map(x=>x.Name).SetAttribute("Column", "PersonName")

would produce

<property Name="Name" column="PersonName" />

I think the above example is in fact implemented using fluent, but I can't
remember the syntax off the top of my head.

1.7 All of my entities inherit from Entity<TKey> - I was expecting that the
> ForTypesThatDeriveFrom<Type> method allow me to specify conventions across
> all my types therefore, but its actual behaviour appears to be to only
> affect the Type itself - I would like the expected behaviour, but I would
> also like a method  orType<Type> to allow me to target a specific type.  I
> would also like a method that can take a Func(Type => bool) so I can apply
> some conventions toseveral types at once (or is this the Where method, and
> I'm confused? I'm reasonably new to fluent-interfaces in C# in general, as
> well asLINQ).


So know where away from the core fluent stuff and into specifics of
AutoMapping. A quick introduction goes like this.

AutoMapping sit's ontop of the current FluentNhibernate code base, and will
scan over your assemblies and attempt to map the below:

   - one-many relationships
   - many-one relationships
   - all properties

However there are time's when it's just not possible for it to work out your
relationship ie, Many-To-May or One-to-One. In these situations you map
something similar to below:

AutoPersistenceModel
    .MapEntitiesFromAssemblyOf<Company>()
    .Where( t => (t.BaseType != typeof(Entity<>))
    .ForTypesThatDeriveFrom<Task>(map => map.HasManyToMany<User>(t =>
t.Users))
    .Configure(this.configuration);

The FotTypeThatDeriveFrom is here for that exact reason to allow you to
override any decisions that AutoMapping has made for you. If you wan't to
apply conventions at the moment you can only apply conventions accross all
your types and it's limited in it's ability. There is a
.WithConvention Method off the AutoPersistanceModel class that allows you to
set conventions such as cascades, lazy loading, primary key names.

Hope this helps, let me know if you have any problems.

Andy

On Thu, Oct 16, 2008 at 1:28 PM, petemounce <[EMAIL PROTECTED]> wrote:

>
> Hi there
>
> I'm experimenting with AutoMap in trunk, against trunk NH (thanks for
> that, Chad!).  I have a bunch of questions (about this magically
> brilliant feature!)...
>
> What is possible via the conventions?  I've changed my foreign-key
> names such that they are prop.Name + "FkId".
> 1.1 Is it possible to change the foreign key relationship names so
> they're like FK_{tablename}_{FK_tablename} ?  At the moment, these
> keys are non-human-readable strings like FK76553BBAAD1ED7F4 (I guess
> this is a hash?).
>
> 1.2 Can I pluralize table-names somehow?
>
> 1.3 I have some enums as entity properties - what happens to these?
> Can those be mapped to tables and automatically populated as foreign-
> key relationships, so they're in the DB for a DBA to understand if he
> needs to?  If this is possible, can I specify that the schema for this
> dictionary data be different from the schema for other tables?
>
> 1.4 The PersistenceModel.WriteMappings(foldername) method doesn't
> appear to do anything...?  I was expecting it to write out the XML for
> the mapping files to a folder (I used c:\\), but nothing appeared (I
> don't think permissions are an issue).
>
> 1.5 Can I order the table-columns such that the primary key comes
> first, then all the foreign keys, then everything else?
>
> 1.6 I Guess constraints, defaults, and cascades are mapped via
> SetAttribute - am I right to think that this method sets the
> attributes on what will be the class node of the hbm mapping?  Perhaps
> this could be renamed to SetClassAttribute?
>
> 1.7 All of my entities inherit from Entity<TKey> - I was expecting
> that the ForTypesThatDeriveFrom<Type> method allow me to specify
> conventions across all my types therefore, but its actual behaviour
> appears to be to only affect the Type itself - I would like the
> expected behaviour, but I would also like a method ForType<Type> to
> allow me to target a specific type.  I would also like a method that
> can take a Func(Type => bool) so I can apply some conventions to
> several types at once (or is this the Where method, and I'm confused?
> I'm reasonably new to fluent-interfaces in C# in general, as well as
> LINQ).
>
> Thank you very much for your time and effort writing this!
>
> Regards
> Pete
> >
>


-- 
=================
I-nnovate Software - Bespoke Software Development, uk wirral.
http://www.i-nnovate.net

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
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