title: EF Code first migrations in Azure functions project
body: <p>I want to use EF Code first migrations in Azure functions project which is class library <code>.net 4.6.2</code> with <code>EF 6.2.0</code>. I added db context and entities. When i try to run  <code>enable-migrations</code> or <code>add-migration</code> by setting this class library as default project then getting below error. I don't have any web projects in the solution.</p>
  
  <blockquote>
    <p>Exception calling "SetData" with "2" argument(s): "Type 
    'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject'
    in assembly  'Microsoft.VisualStudio.ProjectSystem.VS.Implementation,
    Version=15.0.0.0, Culture=neutral,  PublicKeyToken=b03f5f7f11d50a3a'
    is not marked as serializable." At
    C:\Users\xxxxx-win.nuget\packages\entityframework\6.2.0\tools\EntityFramework.psm1:720
    char:5
    +     $domain.SetData('project', $project)
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : SerializationException</p>
  </blockquote>
  
  <p>But when i run the project then it automatically creates <code>__MigrationHistory</code> table with  <code>InitialCreate</code> entry. But i can't see this migration file anywhere in the solution.</p>
  
  <p>dbcontext file for reference.</p>
  
  <pre><code> public class TestDbContext : DbContext
      {
          public TestDbContext(string cs)
              : base(cs)
          {
          }
  
          public TestDbContext() :
              base(ConfigurationManager.ConnectionStrings["sql_connection"].ConnectionString)
          {
              Database.SetInitializer(new TestDBInitializer());
          }
  
          protected override void OnModelCreating(DbModelBuilder modelBuilder)
          {
              modelBuilder.Entity&lt;TestRaw&gt;().ToTable("TestRaw");
              modelBuilder.Entity&lt;TestRequest&gt;().ToTable("TestRequest");
          }
  
          public virtual DbSet&lt;TestRaw&gt; TestRaw { get; set; }
  
          public virtual DbSet&lt;TestRequest&gt; TestRequest { get; set; }
  
      }
      public class TestDBInitializer : CreateDatabaseIfNotExists&lt;TestDbContext&gt;
      {
          protected override void Seed(TestDbContext context)
          {
              base.Seed(context);
          }
      }
  </code></pre>
  
  <p>Also, azure functions doesn't use  app.config. So not sure where EF related dependencies are registered? Can we use EF Code first migrations with Azure functions?  If yes, how to see migrations folder and relevant files ? do i need to take care anything related to migrations while deploying to functionapp?</p>