Cast between Oracle Table field and Entity framework fails
===

Within a WCF web service I make a query on a ORACLE 11g database and I use entity framework as model. The target field is of type Numeric, while in the entity framework is Int64.

When I try to update the field I get the following exception: <b>The specified cast from a materialized 'System.Decimal' type to the 'System.Int64' type is not valid.</b>
The method generating the error is below, in particular for the line within the else statement: <b>result = _context.ExecuteStoreQuery<long>(query).FirstOrDefault();</b> 

    public string GetDatabaseTimestamp(Type timestampFieldType, string query)
    {
      object result;

      if (timestampFieldType == typeof(string))
      {
        result = _context.ExecuteStoreQuery<string>(query).FirstOrDefault();
      }
      else
      {
        result = _context.ExecuteStoreQuery<long>(query).FirstOrDefault();
      }

      return result.ToString();
    }

Would it be possible to define at the EF level a converter or something similar? The option of changing the Database is not feasible, therefore I have to edit code.