Remotion.Linq.SqlBackend.UnitTests.MappingResolverStub_CreateDatabaseUtility.GetSqlValueString C# (CSharp) Метод

GetSqlValueString() приватный статический Метод

private static GetSqlValueString ( object columnValue ) : string
columnValue object
Результат string
    private static string GetSqlValueString (object columnValue)
    {
      if (columnValue == null)
        return "NULL";

      var underlyingType = columnValue.GetType();
      underlyingType = Nullable.GetUnderlyingType (underlyingType) ?? underlyingType;

      switch (underlyingType.Name)
      {
        case "String":
          return "'" + ((string) columnValue).Replace ("'", "''") + "'";
        case "Guid":
          return "'" + columnValue + "'";
        case "DateTime":
          return "'" + ((DateTime) columnValue).ToString ("yyyy-MM-dd") + "'";
        case "Boolean":
          return columnValue.Equals (true) ? "1" : "0";
        default:
          return columnValue.ToString();
      }
    }