Okay,
Finally had a chance to upgrade to S#arp Arch 1.0 RTM again, and to
further upgrade to NH 2.1GA + FNH r542. Quick aside: building FNH on
Windows is tough with rake. I just did a Release build in VS after
having no success with Rake.
The changes work like a charm. Thanks again.
Here's my convention code if it helps anyone else:
public class JoinedSubclassConvention : IJoinedSubclassConvention
{
public bool Accept(IJoinedSubclass subclass)
{
return true;
}
public void Apply(IJoinedSubclass subclass)
{
subclass.WithTableName(Inflector.Net.Inflector.Pluralize
(subclass.EntityType.Name)); // Plural table name
subclass.KeyColumnName(subclass.EntityType.BaseType.Name +
"Id"); // "EntityId" style ID column name
}
}
- Chris
On Jul 20, 5:40 pm, James Gregory <[email protected]> wrote:
> Agreed, it's annoying. It would've been nice to get the releases in sync,
> but Billy is an even faster worker than myself.
>
> On Mon, Jul 20, 2009 at 10:37 PM, Chris Fazeli <[email protected]> wrote:
>
> > Hi James,
>
> > Thanks, I'll give this a try and report back.
>
> > As I'm using #Arch, this may be a bit tough. I've reverted from 1.0
> > RTM back to r478 from the trunk to avoid this issue. I guess I can now
> > upgrade to 1.0 RTM, then further upgrade to NH 2.1GA and the latest
> > revision of FNH to make use of your new code.
>
> > When you refactor to release for v1.0 (I presume), I'll just update
> > again and change my code accordingly.
>
> > It's just a shame that I have to break from #Arch 1.0 RTM so soon :\
>
> > Thanks,
> > - Chris
>
> > On Jul 20, 3:47 pm, James Gregory <[email protected]> wrote:
> > > Hey Chris,
> > > Sorry I didn't get back to you sooner. If you update to the latest FNH
> > > (watch out, we've just upgraded to 2.1GA) there's a commit in there that
> > > fixes the WithTableName, and provides an alternative to using the
> > > convention. Problem is this is all changing in our refactoring branch, so
> > > I'm reluctant to put too much time to fix this properly; what I've done
> > > instead is add an extra method to the joined subclasses (KeyColumnName)
> > that
> > > you can use within your joined subclass convention to override the key
> > > column name. It's not ideal but it should work.
>
> > > Let me know how it goes.
>
> > > On Mon, Jul 20, 2009 at 1:46 PM, Chris Fazeli <[email protected]>
> > wrote:
>
> > > > Hi James,
>
> > > > Did you have a chance to look at this problem? You had mentioned on
> > > > the #Arch forum that you may get a chance to look at it on Friday.
>
> > > > Thanks for the help,
> > > > - Chris
>
> > > > On Jul 16, 7:15 pm, James Gregory <[email protected]> wrote:
> > > > > Have you tried updating your FNH?
>
> > > > > On Fri, Jul 17, 2009 at 12:13 AM, Chris Fazeli <[email protected]>
> > > > wrote:
>
> > > > > > I'm looking to use a convention to have the automapper to recognize
> > > > > > pluralized table names for joined subclasses.
>
> > > > > > At the moment, with the latest build of FNH (in S#arp Architecture
> > 1.0
> > > > > > RTM r486), automapping requires that the joined subclass tables be
> > > > > > singular named. Furthermore, the PrimaryKeyConvention I have is
> > > > > > ignored, and the PKs are expected to be the name of the parent
> > class,
> > > > > > singularlized.
>
> > > > > > Here's an example:
> > > > > > Our database has a pluralized Businesses table with the
> > "BusinessId"
> > > > > > convention as the PK, and there are three inheriting tables that
> > > > > > should each have PK "BusinessId" and pluralized table names. The
> > > > > > matching domain entities all have singular names.
>
> > > > > > I tried using this:
> > > > > > public class JoinedSubclassConvention : IJoinedSubclassConvention {
> > > > > > public bool Accept(IJoinedSubclass subclass) {
> > > > > > return true;
> > > > > > }
> > > > > > public void Apply(IJoinedSubclass subclass) {
> > > > > > subclass.WithTableName(Inflector.Net.Inflector.Pluralize
> > > > > > (subclass.EntityType.Name));
> > > > > > }
> > > > > > }
>
> > > > > > But WithTableName is Not Implemented. This also doesn't explain why
> > my
> > > > > > PrimaryKeyConvention is ignored for these joined subclasses.
>
> > > > > > How do I get by this to have my PKs match the parent's PK, and my
> > > > > > tables to be pluralized? Any help would be appreciated.
>
> > > > > > Cheers,
> > > > > > - Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---