I have model:
public class FlyerPage
{
public Guid Id { get; set; }
public string Picture { get; set; }
public int? Page { get; set; }
public string Text { get; set; }
public ICollection<string> Keywords { get; set; }
public Guid FlyerId { get; set; }
public virtual Flyer Flyer { get; set; }
}
And I want to map Keywords
to one column in FlyerPage
table.
I think the best way it to split it into values separated by comma like
"one", "two", "three".
How to do it? Via FluentAPI.
EDIT - To another table
The type 'ICollection<string>' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method
modelBuilder.Entity<FlyerPage>().Map(m =>
{
m.Property(p => p.Keywords);
m.ToTable("Keyword", "Flyers.Page");
});
EDIT 2: ok this work
modelBuilder.Entity<FlyerPage>().Map(m =>
{
m.Properties(p => p.Keywords);
m.ToTable("FlyerPageKeywords");
});
But how connect it will many to many?