Interesting, something must have broken the old way of doing it. We should
probably either remove that extension method or fix it...

On Sun, Aug 2, 2009 at 10:30 PM, John <[email protected]> wrote:

>
> I was gathering the assembly from the model itself. Below is the code
> I was using to call the method I posted before.
>
> var config = NHibernateSession
>                .Init(new HttpContextSessionStorage(), new Assembly[]
> {
>                    typeof(ProductMap).Assembly
>                });
>
> However I had a new look over the Fluent NHibernate wiki pages and
> changed my code to setup the NHibernate configuration using
> FluentConfiguration. Using that everything seems to be working now.
> I'm not sure why the extension method AddMappingsFromAssembly wasn't
> working for a plain old configuration but it definetely wasn't picking
> up on my mapping classes because I added a break point in the mapping
> class as suggested which never hit.
>
> All is ok now though, thanks for your help.
>
> John
>
> On Aug 2, 2:59 am, Paul Batum <[email protected]> wrote:
> > How are you getting that list of assemblies that you are iterating over?
> > Have you put a breakpoint in your classmap to confirm that it is being
> > loaded?
> >
> > On Sat, Aug 1, 2009 at 5:45 AM, John <[email protected]> wrote:
> >
> > > My older dll was file and assembly version 0.1.0.0.
> > > I setup NHibernate with this code:
> >
> > >            Configuration cfg = new Configuration().Configure();
> >
> > >            foreach (Assembly assembly in assemblies)
> > >            {
> > >                cfg.AddMappingsFromAssembly(assembly);
> > >            }
> >
> > >                        SessionFactory = cfg.BuildSessionFactory();
> > >                        Storage = storage;
> >
> > >            return cfg;
> >
> > > And the full error message is pasted below:
> >
> > > Server Error in '/' Application.
> > > No persister for: JohnHarmanLtd.Web.FineArtCompany.Models.Person
> > > Description: An unhandled exception occurred during the execution of
> > > the current web request. Please review the stack trace for more
> > > information about the error and where it originated in the code.
> >
> > > Exception Details: NHibernate.MappingException: No persister for:
> > > JohnHarmanLtd.Web.FineArtCompany.Models.Person
> >
> > > Source Error:
> >
> > > Line 143:        protected D GetByID<D, IdD>(IdD id, bool
> > > checkForIsDeleted)
> > > Line 144:        {
> > > Line 145:            return Session.Get<D>(id);
> > > Line 146:        }
> > > Line 147:
> >
> > > Source File: d:\Coding\Working_On\FineArtCompanySoln\Website\App_Code
> > > \Repositories\Repository.cs    Line: 145
> >
> > > Stack Trace:
> >
> > > [MappingException: No persister for:
> > > JohnHarmanLtd.Web.FineArtCompany.Models.Person]
> > >   NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String
> > > entityName) +103
> > >   NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent
> > > event, LoadType loadType) +112
> > >   NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType
> > > loadType) +159
> > >   NHibernate.Impl.SessionImpl.Get(String entityName, Object id) +186
> > >   NHibernate.Impl.SessionImpl.Get(Type entityClass, Object id) +137
> > >   NHibernate.Impl.SessionImpl.Get(Object id) +175
> >
> > >
> JohnHarmanLtd.Web.FineArtCompany.Repositories.RepositoryWithTypeId`2.GetByID
> > > (IdD id, Boolean checkForIsDeleted) in d:\Coding\Working_On
> > > \FineArtCompanySoln\Website\App_Code\Repositories\Repository.cs:145
> >
> > >
> JohnHarmanLtd.Web.FineArtCompany.Repositories.RepositoryWithTypeId`2.GetByID
> > > (IdT id) in d:\Coding\Working_On\FineArtCompanySoln\Website\App_Code
> > > \Repositories\Repository.cs:135
> >
> > >
> JohnHarmanLtd.Web.FineArtCompany.Repositories.RepositoryWithTypeId`2.GetByID
> > > (IdT id) in d:\Coding\Working_On\FineArtCompanySoln\Website\App_Code
> > > \Repositories\Repository.cs:58
> > >   JohnHarmanLtd.Web.FineArtCompany.BLL.PersonFactory.GetPerson(Int32
> > > artistID) in d:\Coding\Working_On\FineArtCompanySoln\Website\App_Code
> > > \BLL\PersonFactory.cs:66
> > >   JohnHarmanLtd.Web.FineArtCompany.PrintsByColour.initArtist
> > > (HyperLink lnk, Int32 artistID, Boolean addText) in d:\Coding
> > > \Working_On\FineArtCompanySoln\Website\PrintsByColour.aspx.cs:91
> > >   JohnHarmanLtd.Web.FineArtCompany.PrintsByColour.initArtistList() in
> > > d:\Coding\Working_On\FineArtCompanySoln\Website\PrintsByColour.aspx.cs:
> > > 78
> > >   JohnHarmanLtd.Web.FineArtCompany.PrintsByColour.Page_Load(Object
> > > sender, EventArgs e) in d:\Coding\Working_On\FineArtCompanySoln\Website
> > > \PrintsByColour.aspx.cs:29
> > >   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,
> > > Object o, Object t, EventArgs e) +14
> > >   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
> > > sender, EventArgs e) +35
> > >   System.Web.UI.Control.OnLoad(EventArgs e) +99
> > >   System.Web.UI.Control.LoadRecursive() +50
> > >   System.Web.UI.Page.ProcessRequestMain(Boolean
> > > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> > > +627
> >
> > > Version Information: Microsoft .NET Framework Version:2.0.50727.3053;
> > > ASP.NET Version:2.0.50727.3053
> >
> > > On Jul 31, 8:11 am, James Gregory <[email protected]> wrote:
> > > >  What version are you upgrading from?
> > > > I seem to remember there being a problem once with
> > > AddMappingsFromAssembly,
> > > > but I can't remember if it was fixed.
> >
> > > > On Fri, Jul 31, 2009 at 7:15 AM, Paul Batum <[email protected]>
> > > wrote:
> > > > > It doesn't sound familiar. Can you post more error detail?
> >
> > > > > On Fri, Jul 31, 2009 at 8:59 AM, John Harman <
> [email protected]
> > > >wrote:
> >
> > > > >> Hi,
> >
> > > > >> As the title suggests really, I'm adding my mappings by using the
> > > > >> method .AddMappingsFromAssembly(assembly);
> >
> > > > >> This was working just fine before but now, as I said above,
> NHibernate
> > > > >> cannot find a persister.
> >
> > > > >> Has anyone else come across this problem?
> >
> > > > >> Kind regards,
> >
> > > > >> John Harman
> >
>

--~--~---------~--~----~------------~-------~--~----~
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