views:

45

answers:

2

If I have a field in the db which stores a set of comma separated strings (says tags), how can I instruct fluent Nhibernate to pick it up at List<string>()
e.g.

Public IList<string> Tags {get; set;}

Db field values:

Mvc, .net, FNH 
+2  A: 

IUserType is what you're looking for.

You'll need to implement that interface to provide a mapping from/to the comma separated strings from/to the List.

Personally, I'd leave it alone and project the tags as IEnumerable using a Regex.

Diego Mijelshon
+1  A: 

From NHusers list:

One method:

private string NonRelationalTags 
{ get  { return joinlist(Tags); } 
set
{Tags = parselist(value);}}  

map this with NH using normal or equivalent.

Quintin Par