views:

30

answers:

2

Is possible mapping vector types on nhibernate?

I have a property like this...

string[] myDesc

and I would map every vector value to a specific column of my table...for example:

myDesc[0] --> myDbColumn01
myDesc[1] --> myDbColumn02
myDesc[2] --> myDbColumn03
...

Is there any way to do it?

+1  A: 

I believe a dynamic-component mapping is what you're after; there is a good example of usage on Ayende's blog.

DanP
+1  A: 

You you can do it by creating an implementation of IUserType. The heavy lifting is done in the NullSafeGet and NullSafeSet methods. In your implementation, those methods would convert the value from the database to an array and back, respectively.

Jamie Ide