Extending fluent nhibernate mappings in another assembly
I am using NHibernate with my ASP.Net MVC application. I am writing some extensions (plugins) for my application. And I load the plugin dynamically (from different assemblies). In my base application, I have many entities and mappings (User, Group, etc.)
I need to create new entities in my extensions, so I am creating a news module, so I need to create a news display. The database news table has a foreign key to the user table. Is there a way to change my user mapping so it will have:
HasMany(x => x.News)
.KeyColumn("UserId")
.Inverse();
Or the only way to do this is to change the code in my User class and recompile the project?
I am not an advanced NHibernate user, so any help would be appreciated. TIA.
a source to share
Free NHibernate can help
Check the Forums Free comparison or, better yet, Automatic matching
Automatic mapping can be overridden for individual properties if you cannot use the default. Also, with white NHibernate, you can specify your own defaults for primary keys, foreign keys, etc.
a source to share
You can automate multiple builds for example.
AutoMap.Assemblies(Assembly.GetExecutingAssembly(),
typeof(MyType).Assembly)
will display the executing assembly and the assembly containing "MyType".
Note that this is a relatively new feature (Feb 19, 2010) in FNH, so make sure you have a recent build.
Not sure how this would work in a dynamic loading situation, but I think there is more of a problem with how you get the list of assemblies (possibly via reflection) than NHibernate.
a source to share