Hudson -

Thanks for responding.

Essentially, I have two class libraries with DTO's in them. To
illustrate, I have created a simple mapping exercise against
Northwind, having to Clas libraries with one class each: Cateogry in
one, product in the other. Fluent Configuration is:

ISessionFactory sessionFactory = Fluently.Configure()
       .Database(MsSqlConfiguration.MsSql2005.ConnectionString
            (c => c.Is(@"Data Source=.\sqlexpress;Initial
Catalog=Northwind;Integrated Security=True")).ShowSql())
.Mappings(m => m.AutoMappings.Add(
           AutoPersistenceModel.MapEntitiesFromAssemblyOf<Product>()
           .AutoMap<Category>()
           .WithSetup(s => s.IsBaseType = type => type == typeof
(BaseEntity))
           .Where(type => type.IsSubclassOf(typeof(BaseEntity)))
           .ConventionDiscovery.AddFromAssemblyOf<PluralizeTableNameConvention>)
            ).BuildSessionFactory();

The AutoMap<Cateogry> after the MapEntitesFromAssemblyOf<Product> will
produce the desired mappings, and gives me a desired reference between
Category and Product (via an IList<Product> Products property in
category).

What I was hoping was instead of using AutoMap<Category> (moving
beyond the simple exercise, there could be MANY AutoMap<> appended), I
could use something similar to MapEntitesFromAssemblyOf<Product>, but
for the Category assembly. I have also played with this:

Fluently.Configure()
     .Mappings(m =>
     {
          m.AutoMappings.Add(new AutoPersistenceModel(typeof
(Category).assembly));
          m.AutoMappings.Add(new AutoPersistenceModel(typeof
(Product).assembly));
     });

But was not getting it to work.

Again, thanks for the feedback and any pointers.

Cheers!

C

On Apr 15, 1:00 am, Hudson Akridge <[email protected]> wrote:
> Disclaimer: I don't have a ton of practical Automapping experience, as I
> have no need to use it in my day to day activities.
> You're asking two questions here, and I'm not sure if they're related to the
> same problem.
> 1.) Are you having a problem with the "MergeWithAutoMapsFromAssembly" call?
> Could you briefly explain how you're expecting it to work in your
> environment? That method name might be misleading, from what I can tell
> during my investigations (and I could be wrong here), that call does not
> actually automap the assembly you're referencing. It simply adds that
> assemblies ClassMap<T> types to the current AutoPersistenceModel.
> 2.) You state your entities are split among several classes. In what way?
> Could you provide a simplified class data definition for some of the classes
> you're attempting to search on and an example of the search you're
> attempting to perform?
>
>
>
> On Mon, Apr 13, 2009 at 10:19 PM, Swampy <[email protected]> wrote:
>
> > I have seen several posts asking this question, but, I am not sure
> > that I have seen an answer.
>
> > My Entities are split among several classes, but, I need to be able to
> > query on them. Is there a way to use AutoPersistenceModel to include
> > these files?
>
> > For example, if I have Product and Category in separate assemblies.I
> > thought I might be able to use:
> >           var autoMappings =
> >           AutoPersistenceModel
> >          .MapEntitiesFromAssemblyOf<Category>()
> >          .MergeWithAutoMapsFromAssemblyOf<Product>()
> >          .WithSetup(s => s.IsBaseType = type => type == typeof
> > (BaseEntity))
>
> >  .ConventionDiscovery.AddFromAssemblyOf<PluralizeTableNameConvention>
> > ()
>
> > I don't understand the purpose of "MergeWithAutoMapsFromAssembly"
>
> > Please, any help, guidance or just a point in the right direction
> > would be helpful!!
>
> > Chuck- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to