title: Entity Framework: map varchar to DateTime property
body: <p>Entity Framework 4 . MySQL</p>
  
  <p>I'm trying to map a <strong>varchar column</strong> to a class's <strong>DateTime</strong> property</p>
  
  <p>my class:</p>
  
  <pre><code>[Table("webnews_in")]
  public class WEBNews_in : AbsNews
  {
      private DateTime _inDateTimeAdded = DateTime.MinValue;
  
      public DateTime InDateTimeAdded
      {
          get { return _inDateTimeAdded; }
          set { _inDateTimeAdded = value; }
      }
  
      private DateTime _inDateTimeUpdated = DateTime.MinValue;
  
      public DateTime InDateTimeUpdated
      {
          get { return _inDateTimeUpdated; }
          set { _inDateTimeUpdated = value; }
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>CREATE TABLE webnews_in
      (
      Id                INT NOT NULL auto_increment,
      VPN_AC              VARCHAR (20) NULL,
      InDateTimeAdded   VARCHAR (50) NULL,
      InDateTimeUpdated VARCHAR (50) NULL
  
      PRIMARY KEY (Id)
      );
  </code></pre>
  
  <hr>
  
  <p>I got this error:</p>
  
  <pre><code>    Input string was not in a correct format. 
      Message Input string was not in a correct format. 
      Data IDictionary (0 items) 
  
  
  StackTrace    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal)
     at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
     at MySql.Data.Types.MySqlDateTime.ParseMySql(String s)
     at MySql.Data.MySqlClient.MySqlDataReader.GetDateTime(Int32 i)
     at MySql.Data.Entity.EFMySqlDataReader.GetDateTime(Int32 ordinal) 
  HelpLink null  
  Source mscorlib 
  </code></pre>