Nhibernate: creating a list <string> via <component>

If I have a field in db that stores a set of comma-separated strings (says tags), how can I teach a fluent Nhibernate to pick it up in List<string>()
for example

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

Values ​​of the Db field:

Mvc, .net, FNH 
+5
source share
2 answers

IUserType - this is what you are looking for.

You will need to implement this interface in order to display from / to strings, separated by commas, from / to the list.

Personally, I left him alone and projected the tags as IEnumerable using Regex.

+2
source

From the NHusers list:

One method:

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

NH,   .

+1

All Articles