I had added a concept of mappingFiles separate from mappingAssemblies. By
doing so added loadAssemblies so that you could load assemblies required by
your hbm files.
<hbm2ddl
connectionprovider="NHibernate.Connection.DriverConnectionProvider"
dialect="NHibernate.Dialect.MsSql2005Dialect"
connectiondriverclass="NHibernate.Driver.SqlClientDriver"
connectionstring="server=${database.host};database=${initial.catalog};
Integrated Security=SSPI;"
outputtoconsole="false"
exportonly="true"
formatnice="true"
outputfilename="${project::get-base-directory()}/schema.sql">
<loadAssemblies>
<include
name="${project::get-base-directory()}/../bin/Project1.Domain.Common.dll" />
</loadAssemblies>
<mappingAssemblies>
<include
name="${project::get-base-directory()}/../bin/Project1.Portal.Domain.dll" />
</mappingAssemblies>
</hbm2ddl>
OR
<loadAssemblies>
<include name="C:\dev\Project1.Domain.dll" />
<include name="C:\dev\Project1.Domain.Common.dll" />
</loadAssemblies>
<mappingFiles>
<include name="C:\dev\Customer.hbm.xml" />
<include name="C:\dev\Dog.hbm.xml" />
<include name="C:\dev\Cat.hbm.xml" />
</mappingFiles>
Sort of inspired by Ant's ability to do something similar in Java.
Unfortunately in .Net we have to have those assemblies that contain the POCO
classes loaded in order to forward engineer the schema. I still wish there
was a better way to do this without having to load the assemblies and it's
dependencies but I haven't found a better way.
-Scott
On Wed, Sep 9, 2009 at 9:38 AM, Fabio Maulo <[email protected]> wrote:
> I'm curious... I don't understand why something like this shouldn't work
> <mapping assembly="YouAssembly.DataAccessObjects.Nh"
> resource="YouAssembly.DataAccessObjects.Nh.Mappings.AClass.hbm.xml" />
> <mapping assembly="YouAssembly.DataAccessObjects.Nh"
> resource="YouAssembly.DataAccessObjects.Nh.Mappings.AnotherClass.hbm.xml" />
> </session-factory>
>
> You can specify mappings one-by-one if needed.
> Using NH3.0.0 and its configuration by-code you can even more.
>
> 2009/9/9 Scott White <[email protected]>
>
> last few files were too big so I uploaded them. Get them at:
>> files.me.com/scott.w.white/e0797x
>>
>> You'll need 7zip to extract
>>
>> On Tue, Sep 8, 2009 at 10:02 PM, Scott White <[email protected]>wrote:
>>
>>> I've attached the updates for 2.1. There is a small problem. The
>>> current builds of NAnt use an old version of log4net which has a different
>>> public key token. This means you can't replace the log4net that NAnt uses
>>> with the latest version. You can however load them side-by-side. I
>>> documented this on my blog:
>>>
>>>
>>> http://scottwhite.blogspot.com/2009/08/working-around-dll-hell-in-net.html
>>>
>>> If anyone can think of a better solution give it a shot.
>>>
>>> I've also attached a recent build of NAnt with necessary hacks to get
>>> this working. The long term solution would be to get NAnt to use a more
>>> recent version of log4net.
>>>
>>> -Scott
>>>
>>> On Tue, Sep 8, 2009 at 12:34 PM, Tuna Toksoz <[email protected]> wrote:
>>>
>>>> Just drop the binaries here as an attachment. whoever has time and sees
>>>> necessity will commit.
>>>>
>>>> Tuna Toksöz
>>>> Eternal sunshine of the open source mind.
>>>>
>>>> http://devlicio.us/blogs/tuna_toksoz
>>>> http://tunatoksoz.com
>>>> http://twitter.com/tehlike
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Sep 8, 2009 at 1:30 PM, Scott White <[email protected]>wrote:
>>>>
>>>>> I have it working locally with a little improvement that I made. One
>>>>> thing, I don't have commit so I'll need somebody to check this code in.
>>>>> If
>>>>> anyone wants it in the mean time just ping me and I'll email the source to
>>>>> you as a zip.
>>>>>
>>>>> Thanks,
>>>>> Scott
>>>>>
>>>>>
>>>>> On Fri, Sep 4, 2009 at 12:13 AM, Nettdata <[email protected]> wrote:
>>>>>
>>>>>>
>>>>>> Hey Scott-
>>>>>>
>>>>>> Very cool! I just went looking for an updated NHIbernate.Tasks today,
>>>>>> and couldn't find anything.
>>>>>>
>>>>>> Any thoughts when you might have something to try out?
>>>>>>
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>>
>>>>>>
>>>>>> ...jeff
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Aug 25, 9:11 am, Scott White <[email protected]> wrote:
>>>>>> > I'm working on updating NHibernate.Tasks (use for NAnt builds) to
>>>>>> > NHibernate 2.1 and adding a new feature. Basically you will be able
>>>>>> > to specify Hibernate mapping files as an alternative to just the
>>>>>> > assemblies. This will allow you to only build certain tables, which
>>>>>> > is important in app revisions. I will be building & testing against
>>>>>> > NAnt .86.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
>
> --
> Fabio Maulo
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"NHibernate Contrib - Development Group" 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.ar/group/nhcdevs?hl=en
-~----------~----~----~----~------~----~------~--~---