title: How to Convert 'Uri' into String when using entity framework core
body: <p>I want to create database tables using Entity framework core from POCO-classes. When I try and add a new scaffold item (option: Razor pages using Entity Framework (CRUD) in VS), there's an error saying: "No suitable constructor found for entity type 'Uri'"</p>
  
  <p>Ive learnt that (amongst others) Uri has to be converted into String in the OnModelCreating method (in the class which inherits from dbContext).</p>
  
  <p>DbContext class:</p>
  
  <pre><code>    public class SchoolDbContext : DbContext {
        public DbSet&lt;Student&gt; Students { get; set; }
  
        protected override void OnModelCreating(ModelBuilder modelBuilder) {
          modelBuilder.Entity&lt;Student&gt;()
          .Property(t =&gt; t.Homepage)
          .HasConversion(
          v =&gt; v.ToString(),
          v =&gt; new Uri(v));
        }
      }
  </code></pre>
  
  <p>Student class:</p>
  
  <pre><code>    public class Student {
        public int ID { get; set; }
        public Uri Homepage {get; set; }
      }
  </code></pre>
  
  <p>I know that the OnModelCreating method is called when the command "Add-Migration Initial" is entered. But since I tried to auto-implement the CRUD classes, I cannot enter the command "Add Migration Initial".
  Thanks a lot and excuse my poor english..</p>