User Agreements in Entity Framework 6

I want to create a convention where EF can serialize IEnumerable<String>

to a format (comma separated values ​​for example) and store them in a column, and when retrieved, create them again IEnumerable<String>

.

The msdn link http://msdn.microsoft.com/en-us/data/jj819164.aspx mentions the following example

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";
        }
    }
}

      

But I need something like

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.
        }
    }

      

I cannot find any obvious way to do this. Any ideas?

+3
c # entity-framework configuration entity-framework-6


source to share


No one has answered this question yet

Check out similar questions:

783
Entity Framework vs LINQ to SQL
758
Entity Framework 5 Record Update
756
Failed to check for one or more objects. For more information, see "EntityValidationErrors Property".
630
Fastest way to insert into Entity framework
515
How can I get the ID of the inserted entity in the Entity framework?
461
How do I view the SQL generated by the Entity Framework?
443
SqlException from Entity Framework - new transaction is not allowed because there are other threads in the session
401
Entity Framework Service Provider not found for ADO.NET Provider with invariant name 'System.Data.SqlClient'
392
Failed to load Entity Framework provider type?
322
Entity Framework - includes multiple levels of properties



All Articles
Loading...
X
Show
Funny
Dev
Pics