You only call AddAssembly once, from there nHibernate takes care of the rest.
here's an example: http://www.martinwilley.com/net/code/nhibernate/sessionmanager.html Check out the s#arp sources if you want some prebuilt code that does all this stuff for you. I don't even use AddAssembly in my code as everything is in one DLL On Aug 31, 1:59 pm, PLen <[email protected]> wrote: > Diego, > > Thanks for the response. This is where I am confused. I am new to > NHibernate so I got started based on examples I found which seemed to > work. For each table (entity), I have a different hbm.xml mapping > file. The mapping files (two) live in the FirstSample.Mappings > directory (FirstSample is the C# project). The two entity class files > live in the FirstSample.Domain directory and as such each of the > classes are in the namespace "FirstSample.Domain". So while they are > two different classes, both of the mapping files have this same entry: > > <hibernate-mapping assembly="FirstSample" > namespace="FirstSample.Domain" xmlns="urn:nhibernate-mapping-2.2"> > > So when I add the assemblies to the configuration, the two lines: > > configuration.AddAssembly(typeof (RptSourceGroup).Assembly); > configuration.AddAssembly(typeof (RptSource).Assembly); > > really evaluate to: > > configuration.AddAssembly(FirstSample.Domain.RptSourceGroup.Assembly); > configuration.AddAssembly(FirstSample.Domain.RptSource.Assembly); > > Now, I am not sure what that really means, but apparently it is > causing a problem which I don't understand. My understanding was that > the assembly name is the name where the domain classes are > implemented, which looked to be the project name. Is this not > correct? I get other errors if I give the files an assembly name of > somethiong random (ex. MyAssemblyName1 and MyAssemblyName2). Are you > saying that because they are in the same assembly (I take that to mean > the same project), that both class definitions need to be within the > same file and not individual files? > > Any help on understanding this would be very much appreciated. > > Thanks - Peter -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
