Yes automapping - not sure quite what info you want re: "how i'm
configuring the automapper", but in a nutshell, I'm using the
following for Session Factory:
Fluently.Configure().Database(MsSqlConfiguration.MsSql2005
.ConnectionString(c => c.Is
(connectionString))
.CurrentSessionContext
("thread_static")
.AdoNetBatchSize(1)
)
.Mappings(m =>
m.AutoMappings.Add(new
AutoPersistenceModel()
.AddEntityAssembly(typeof
(UserInfo).Assembly)
.UseOverridesFromAssemblyOf<UserMap>
()
.Conventions.AddFromAssemblyOf<ReferenceConvention>
()
)
)
.BuildSessionFactory();
then I have all of my custom maps (e.g. UserMap) implement
IAutoMappingOverride<>, and am using a conventions for Id, Reference,
HasMany, and table name from class name. The custom maps usually just
contain "mapping.IgnoreProperty" and overrides Maps for odd instances
where the model doesn't quite match the database (still halfway
between shifting from old data access code to NHib).
So most of the mappings are simple, nothing unexpected. I used to have
a WithTable statement wire up this extra Email property, as described
above, where Email is actually from a column on a different table. On
one hand I could improve the model to reflect the database more
accurately, but I feel like I shouldn't have to (given the power of
NHibernate), nor do I want to risk breaking code in other places (as I
say, we're still halfway shifting from legacy code...).
Not sure if any of that helps you answer my question...
Do I infer from your answer that you would expect the join to just
work? As I say, there is nothing in the generated .hbm.xml that has
anything to do with the Email property joining to this other table.
Is there a simple example of a join I can play with? I can't even get
a simple example to work, and can't find any examples... There's a
comment at the bottom of this page
http://code.google.com/p/fluent-nhibernate/wiki/Examples
which says,
"For RC 1.0 Entity spanning multiple tables the method name has
changed to Join.
>From example above with changes: Join("CustomerAddress", m => { m.Map
(x => x.Address); });"
but this doesn't seem to help...
Cheers,
Tim
On Dec 2, 1:55 pm, James Gregory <[email protected]> wrote:
> Automapping, right? Can you supply us with how you're configuring the
> automapper? and any overrides you're doing?
>
>
>
> On Wed, Dec 2, 2009 at 1:49 PM, Tim <[email protected]> wrote:
> > Hi all,
>
> > We recently upgraded to FluentNHibernate 1.0.0.593, and made the
> > changes necessary e.g. method name changes, dropping "With" etc.,
>
> > However, I'm having problems changing a WithTable join into a Join
> > method.
>
> > Old way:
>
> > mapping.WithTable("aspnet_Membership", m =>
> > {
> > m.Map(x => x.Email, "LoweredEmail");
> > m.WithKeyColumn("UserId");
> > });
>
> > New way:
>
> > mapping.Join("aspnet_Membership", m =>
> > {
> > m.Map(x => x.Email, "LoweredEmail");
> > m.KeyColumn("UserId");
> > });
>
> > The problem is that it's not generating anything to do with
> > "aspnet_Membership" in the .hbm.xml file, and it is not performing the
> > join on select, so the Email property is always null. Am I doing it
> > wrong??
>
> > (Few extra things: I am also doing
>
> > mapping.IgnoreProperty(x => x.Email);
>
> > to ensure it doesn't look for Email column on the primary table, this
> > is how it worked before. I have played with m.Fetch.Join(); and
> > m.Not.Optional();, etc., seems to make no difference...)
>
> > Many thanks,
> > Tim
>
> > --
>
> > 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]<fluent-nhibernate%2Bunsubscr
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
--
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.