Re: Mapping rewrite

"Fabio Maulo" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nhibernate.devel
Message-ID <[email protected]>
Oren, do you can explain the situation ? (the problem to solve... the
analysis... something in English...)
I can't understand where put a code-chunk if I don't understand the
target...

Do you are trying to solve a generic association ?
Do you have an interface in the mapping but you want strongly-type it before
build-session-factory ?

If this is the issue, would be better to end the study around
"mapping-source".

BTW without an whole picture I have some problem to understand what you
need.

2008/6/29 Ayende Rahien <[email protected]>:

> Runtime in this context means _before_ we call BuildSessionFactory, but
> without touching the source XML files.
> Ideally, I want to be able to run this at some point at the config build
> lifetime:
>
> PersistentClass classMapping = cfg.GetClassMapping(userType);
> foreach (PersistentClass persistentClass in cfg.ClassMappings)
> {
>     //ignore non Rhino Security entities
>     if (persistentClass.MappedClass.Assembly != typeof(IUser).Assembly)
>         continue;
>
>     foreach (Property property in persistentClass.PropertyIterator)
>     {
>         ManyToOne manyToOne = property.Value as ManyToOne;
>         if (manyToOne == null || manyToOne.ReferencedEntityName !=
> typeof(IUser).FullName)
>             continue;
>         ManyToOne value = new ManyToOne(classMapping.Table);
>         value.ReferencedEntityName = userType.FullName;
>         foreach (ISelectable selectable in manyToOne.ColumnIterator)
>         {
>             Column col = selectable as Column;
>             if (col != null)
>             {
>                 value.AddColumn(col);
>             }
>         }
>         property.Value = value;
>
>         Collection collection = property.Value as Collection;
>         if (collection == null || collection.IsOneToMany ||
>             collection.GenericArguments.Length != 1 ||
>             collection.GenericArguments[0] != typeof(IUser))
>             continue;
>         IValue element = collection.Element;
>     }
>
>     foreach (ForeignKey key in persistentClass.Table.ForeignKeyIterator)
>     {
>         if (key.ReferencedEntityName != typeof(IUser).FullName)
>             continue;
>
>         key.ReferencedEntityName = userType.FullName;
>         key.ReferencedTable = classMapping.Table;
>     }
> }
>
> On Sun, Jun 29, 2008 at 5:09 PM, Fabio Maulo <[email protected]> wrote:
>
>> 2008/6/29 Ayende Rahien <[email protected]>:
>>
>>> I am _not_ interested in changing the XML. I am interested in selecting,
>>> at runtime, what is the class of the many-to-many association.
>>> There is a difference between them
>>>
>>>
>> At run-time ok; but when ?
>> You know, NH do the hard work of mapping at build-session-factory-time.
>> So far only using <any> you can have an association really resolved at
>> run-time.
>>
>> I need to understand what you are looking for to study the situation.
>> --
>> Fabio Maulo
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Nhibernate-development mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/nhibernate-development
>>
>>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Nhibernate-development mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nhibernate-development
>
>


-- 
Fabio Maulo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.