with cfg.AddAssembly(typeof (Tester).Assembly); you are asking to NH to check the whole assembly not a specific resource. If you want add specific resource-file you have to use AddResource(string path, Assembly assembly)
On Fri, Aug 27, 2010 at 1:31 PM, PLen <[email protected]> wrote: > > > Fabio, > > This is why it seems so confusing. First, here is my mapping file > (Tester.hbm.xml): > > <?xml version="1.0" encoding="utf-8"?> > <hibernate-mapping assembly="FirstSample" xmlns="urn:nhibernate- > mapping-2.2"> > <class name="FirstSample.Domain.Tester, FirstSample" table="TESTER" > lazy="true" > > <id name="recordId" type="Int64" column="RECORD_ID"> > <generator class="sequence"> > <param name="sequence">TESTER_SEQ</param> > </generator> > </id> > <property name="city" column="CITY" /> > <property name="name" column="NAME" /> > <property name="year" column="YEAR" /> > </class> > </hibernate-mapping> > > and here is my Tester.cs: > > namespace FirstSample.Domain { > > public class Tester { > public Tester() { > } > public virtual string city { get; set; } > public virtual string name { get; set; } > public virtual long recordId { get; set; } > public virtual long year { get; set; } > } > } > > Now, going back to what I run, I simply state the following code: > > var cfg = new Configuration(); > cfg.Configure(); > cfg.AddAssembly(typeof (Tester).Assembly); > new SchemaExport(cfg).Execute(true, false, false); > > So as far as I can see, I am just asking to run the Tester.hbm.xml > file. Then I found something interesting. That mapping file is > located in a Mappings subdirectory. If I remove the other > two .hbm.xml files that are in the directory (physically remove the > files from the directory) then only my one file gets run. It seems > that no matter which Assembly I add to my Configuration object, every > mapping file in that directory is used. > > Any clue as to why that happens as I do not list the "Mappings" > directory in any other file as some reference. > > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- 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.
