Ah, I see I forgot an important detail (sorry, guys)
There are only 4 different such CreditCardCompanies (in my system,
currently), and I want to use them only as components of the
Purchase.CreditCard class.
So Purchase is an persisted entity, it has a component CreditCard. The
Credit card has one of the 4 predefined CreditCardCompany
implementations as a property 'Company', similar to an enum.
Actually it has been an enum in the past (persisted with
EnumStringType), but now I want to inject card specific behavior into
it, that's why I converted it to classes.
On Thu, Nov 20, 2008 at 7:49 PM, David Mukaiwa <[EMAIL PROTECTED]> wrote:
> I guess not - it would be impossible to 'defrost. You have to specify the
> type.
>
> +2
>
> On Thu, Nov 20, 2008 at 11:48 PM, David Mukaiwa <[EMAIL PROTECTED]> wrote:
>>
>> Could one not get around this by mapping the abstract type
>> (CreditCardCompany) and exposing a save method in some DAO/Facade, which
>> accepts a CreditCardCompany parameter and passes it onto the ISession?
>>
>> On Thu, Nov 20, 2008 at 11:39 PM, Tuna Toksöz <[EMAIL PROTECTED]> wrote:
>>>
>>> +1
>>>
>>> On Thu, Nov 20, 2008 at 11:35 PM, Victor Kornov <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Single table inheritance mapping with discriminator should work.
>>>>
>>>> On Fri, Nov 21, 2008 at 12:32 AM, Jan Limpens <[EMAIL PROTECTED]>
>>>> wrote:
>>>>>
>>>>> A Creditcard has a CreditcardCompany
>>>>> here is one
>>>>>
>>>>> public abstract class CreditCardCompany
>>>>> {
>>>>> private readonly string name;
>>>>>
>>>>> protected CreditCardCompany(string name)
>>>>> {
>>>>> this.name = name;
>>>>> }
>>>>> }
>>>>>
>>>>> public class Diners : CreditCardCompany
>>>>> {
>>>>> public Diners() : base("Diners")
>>>>> {
>>>>> }
>>>>> }
>>>>>
>>>>> I will add some more logic to it, but no data. What is the easiest way
>>>>> to persist it (basically, I'd be fine with the Type.Name)?
>>>>> I looked into IUserType, but this looks a bit daunting :), especially
>>>>> for something as primitive.
>>>>>
>>>>> I wonder if there is something readymade already. There are a lot of
>>>>> classes in NHibernate.Type but which is which?
>>>>>
>>>>> --
>>>>> Jan
>>>>> ___________________
>>>>> [EMAIL PROTECTED]
>>>>> www.limpens.com
>>>>> +55 (11) 3082-1087
>>>>> +55 (11) 3097-8339
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Tuna Toksöz
>>> http://www.tunatoksoz.com
>>>
>>> Typos included to enhance the readers attention!
>>>
>>>
>>>
>>
>
>
> >
>
--
Jan
___________________
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" 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/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---