私は、EFがIEnumerable<String>
フォーマット(コンマ区切り値など)にシリアル化して列に格納し、それらをフェッチしながらIEnumerable<String>
再度作成できる規則を作成したいと考えています。
msdn リンクhttp://msdn.microsoft.com/en-us/data/jj819164.aspxには、次の例が記載されています。
class DateTimeColumnTypeConvention : IConfigurationConvention<PropertyInfo, DateTimePropertyConfiguration>
{
public void Apply(
PropertyInfo propertyInfo, Func<DateTimePropertyConfiguration> configuration)
{
// If ColumnType hasn't been configured...
if (configuration().ColumnType == null)
{
configuration().ColumnType = "datetime2";
}
}
}
しかし、私は次のようなものが必要です
class DateTimeColumnTypeConvention : IConfigurationConvention<PropertyInfo, IEnumerable<string>>
{
public void Apply(PropertyInfo propertyInfo, Func<IEnumerable<string>> configuration)
{
// Get all the values of the property here, create a comma separated string ,ask EF to store this string by setting the ColumnType to varchar and then get it back.
}
}
これを行う明白な方法を見つけることができません。何か案は ?