title: What is the best way to seed data with a lot of information using EntityFramework Core?
body: <p>I have an entity configuration file and I seed data with the help of <code>HasData</code>, the example below.</p>
  
  <pre><code>public class PublicationConfiguration : IEntityTypeConfiguration&lt;Publication&gt;
      {
          public void Configure(EntityTypeBuilder&lt;Publication&gt; builder)
          {
              builder.Property(p =&gt; p.Image)
                  .HasMaxLength(256)
                  .HasDefaultValue("default-publication.png")
                  .IsRequired();
  
              builder.Property(p =&gt; p.Title)
                  .HasMaxLength(256)
                  .IsRequired();
  
              builder.Property(p =&gt; p.Value)
                  .IsRequired();
  
              builder.Property(p =&gt; p.PublisherId)
                  .IsRequired();
  
              builder.Property(p =&gt; p.CategoryId)
                  .IsRequired();
  
              builder.HasOne(p =&gt; p.Category)
                  .WithMany(categ =&gt; categ.Publications)
                  .OnDelete(DeleteBehavior.Restrict);
  
              builder.HasOne(p =&gt; p.Publisher)
                  .WithMany(pub =&gt; pub.Publications)
                  .OnDelete(DeleteBehavior.Restrict);
  
              builder.HasData(
                  new Publication {
                      Id = "publication-one",
                      Title = "the first publication",
                      Value = "the content of the very first publication on the web-site",
                      CreatedAt = DateTime.Now,
                      CategoryId = "category-one",
                      PublisherId = "publisher-one",
                      Image = "image"
                  },
                  new Publication
                  {
                      Id = "publication-two",
                      Title = "the second publication",
                      Value = "the content of the second publication on the web-site",
                      CreatedAt = DateTime.Now,
                      CategoryId = "category-one",
                      PublisherId = "publisher-two",
                      Image = "image"
                  },
                  new Publication
                  {
                      Id = "publication-three",
                      Title = "the third publication",
                      Value = "the content of the third publication on the web-site",
                      CreatedAt = DateTime.Now,
                      CategoryId = "category-two",
                      PublisherId = "publisher-one",
                      Image = "image"
                  }
              );
          }
      }
  </code></pre>
  
  <p>As you can see I have a property called <code>Value</code>, it's just a string, but I'm going to change it to an array of strings and add some real information meaning <code>Value</code> will contain over a thousand characters, moreover there are only 3 <code>Publications</code> here, but I want to add like 10 more. Thus my seeder will look huge and awful and I do not like it. </p>
  
  <p>So I'd like to move this data anywhere else, maybe to a json file and then read the data from this file or maybe there is a better way, nevertheless I have no idea how I can do this and how to do this right.</p>
  
  <p>The question is, what is the best solution to this problem? And I would be glad to see the solution code.</p>