Indeed, it may be unneeded. Maybe I should be posting to the users
list instead.
We use ActiveRecord to initialize the database, and then to access all
the table and foreign key information, we use the following code:
NHibernate.Cfg.Configuration configuration =
sessionFactoryHolder.GetAllConfigurations()[0];
configuration.SecondPassCompile();
Objects = new
MetaObjectCollection(configuration.TableMappings,
configuration.mapping);
The MetaObjectCollection constructor then accesses the list of tables
from TableMappings and generates its own view of the database schema
from that. The mapping is used in a call to
Column.GetSqlTypeCode(mapping).
Basically, we need a mechanism to access what NHibernate thinks the
database should look like... all the tables, columns, foreign keys,
primary keys, etc.
Does something like this already exist?
Patrick Earl
On Aug 13, 11:18 am, Fabio Maulo <[email protected]> wrote:
> Try to explain because, even if there is no problem to make something
> public,
> to me your patch seems unneeded.
>
>
>
> On Fri, Aug 13, 2010 at 1:32 PM, Patrick Earl <[email protected]> wrote:
> > We have been maintaining an internal patch to NHibernate for quite
> > some time, and I'd ultimately like to be able to run on an unpatched
> > version of NHibernate. The internal patch we use allows us to access
> > the mapping schema that NHibernate generates. This allows us to build
> > our own enhanced system for applying schema updates to the database.
> > I'd submit a patch, but I'm not really sure in which direction to go.
> > I'd love some feedback on how this might be done.
>
> > Here's what our internal patch does to Configuration.cs:
>
> > - private IMapping mapping;
> > + public IMapping mapping;
>
> > - private ICollection<Table> TableMappings
> > + public ICollection<Table> TableMappings
>
> > - private void SecondPassCompile()
> > + public void SecondPassCompile()
>
> > Looking forward to hearing people's thoughts.
>
> > Patrick Earl
>
> --
> Fabio Maulo