I don't like your answer :D

Before you say me that I'm wrong because should work without fix, but 
than you put God in the middle :D


On Tuesday, August 19, 2014 1:36:24 PM UTC+2, Ricardo Peres wrote:
>
> God and NHibernate knows! :-)
>
> RP
>
> On Tuesday, August 19, 2014 12:32:34 PM UTC+1, Matteo Migliore wrote:
>>
>> Yes, I know the same thing, but I was receiving the exception.
>>
>> Why?
>>
>> On Tuesday, August 19, 2014 1:25:15 PM UTC+2, Ricardo Peres wrote:
>>>
>>> It shouldn't be necessary... NHibernate doesn't care about the order by 
>>> which mappings are inserted...
>>>
>>> RP
>>>
>>> On Tuesday, August 19, 2014 12:19:27 PM UTC+1, Matteo Migliore wrote:
>>>>
>>>> Thanks to this article I found the solution.
>>>>
>>>> I created a Type comparer to sort the entity classes based on their 
>>>> inheritance level, the bases first:
>>>> public class OrderTypeByInheritance : IComparer<Type>
>>>> {
>>>> public int Compare(Type x, Type y)
>>>> {
>>>> var xClassMapping = x.BaseType.GetGenericArguments().Single();
>>>> var yClassMapping = y.BaseType.GetGenericArguments().Single();
>>>>
>>>> return 
>>>> xClassMapping.InheritanceLevel().CompareTo(yClassMapping.InheritanceLevel());
>>>> }
>>>> }
>>>>
>>>> public static class TypeExtensions
>>>> {
>>>> public static int InheritanceLevel(this Type type)
>>>> {
>>>> var count = 0;
>>>>
>>>> while (type != typeof(object))
>>>> {
>>>> count++;
>>>> type = type.BaseType;
>>>> }
>>>>
>>>> return count;
>>>> }
>>>> }
>>>>
>>>> Than I used it with the ModelMapper:
>>>> var mapper = new ModelMapper();
>>>> var types = mappingType.Assembly.GetTypes().OrderBy(x => x, new 
>>>> OrderTypeByInheritance());
>>>>
>>>>
>>>> On Tuesday, August 19, 2014 11:43:32 AM UTC+2, Matteo Migliore wrote:
>>>>>
>>>>> Right, sorry:
>>>>> internal class ScheduleMapping : ClassMapping<Schedule> { }
>>>>>
>>>>> internal class EventMapping : JoinedSubclassMapping<Schedule> { }
>>>>>
>>>>> internal class EventExtendedMapping : 
>>>>> JoinedSubclassMapping<EventExtended> { }
>>>>>
>>>>> ---------
>>>>> public abstract class Schedule { }
>>>>>
>>>>> public class Event : Schedule { }
>>>>>
>>>>> public class EventExtended : Event { }
>>>>>
>>>>> Thank you.
>>>>>
>>>>> On Tuesday, August 19, 2014 11:37:04 AM UTC+2, Oskar Berggren wrote:
>>>>>>
>>>>>> I don't see any mappings?
>>>>>>
>>>>>>
>>>>>> 2014-08-19 11:28 GMT+02:00 Matteo Migliore <[email protected]>:
>>>>>>
>>>>>>> Hi!
>>>>>>>
>>>>>>> I map a class with the JoinedSubClass:
>>>>>>> public class Event
>>>>>>> {
>>>>>>> }
>>>>>>>
>>>>>>> public class EventExtended : Event //sample name
>>>>>>> {
>>>>>>> }
>>>>>>>
>>>>>>> NH give me the exception "Cannot extend unmapped class".
>>>>>>>
>>>>>>> What's wrong?
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "nhusers" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to [email protected].
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> Visit this group at http://groups.google.com/group/nhusers.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to