ServiceStack ORMLite:字段顺序的更改会影响结果

时间:2017-05-31 07:36:36

标签: servicestack ormlite-servicestack

我在DB中有一个神秘的错误)))

在此之前没有观察到。

执行查询时,我得到的数据不正确:

var offersList = dbc.Select<Offer>(dbc.From<Catalog>().Where(x => x.user_name == userName));

字段顺序的变化会影响结果:

enter image description here

enter image description here

还有一个错误,我在请求期间得到了经常出现的错误:

{
  "name": "Microsoft.ApplicationInsights.Dev.ae8e217b7ad5482793a95b29e6da7786.Exception",
  "time": "2017-05-31T07:57:07.4118767Z",
  "iKey": "ae8e217b-7ad5-4827-93a9-5b29e6da7786",
  "tags": {
    "ai.cloud.roleInstance": "DESKTOP-76J6ML2",
    "ai.internal.sdkVersion": "unobs:2.2.0-738"
  },
  "data": {
    "baseType": "ExceptionData",
    "baseData": {
      "ver": 2,
      "properties": {
        "DeveloperMode": "true"
      },
      "exceptions": [
        {
          "id": 47651295,
          "typeName": "System.AggregateException",
          "message": "A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.",
          "hasFullStack": true
        },
        {
          "id": 15487060,
          "outerId": 47651295,
          "typeName": "System.AggregateException",
          "message": "One or more errors occurred.",
          "hasFullStack": true
        },
        {
          "id": 5188,
          "outerId": 15487060,
          "typeName": "System.Net.WebException",
          "message": "The remote server returned an error: (404) Not Found.",
          "hasFullStack": true,
          "parsedStack": [
            {
              "level": 0,
              "method": "System.Net.HttpWebRequest.EndGetResponse",
              "assembly": "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            },
            {
              "level": 1,
              "method": "System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic",
              "assembly": "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            }
          ]
        }
      ],
      "severityLevel": "Critical"
    }
  }
}

修改

记录结果:

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

[3:30] 
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

[3:30] 
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

[3:30] 
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

[3:30] 
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

[3:30] 
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

[3:30] 
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
   at System.Convert.ToInt64(Object value)
   at ServiceStack.OrmLite.OrmLiteConverterExtensions.ConvertNumber(IOrmLiteDialectProvider dialectProvider, Type toIntegerType, Object value)
   at ServiceStack.OrmLite.Converters.IntegerConverter.FromDbValue(Type fieldType, Object value)
   at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.PopulateWithSqlReader[T](T objWithProperties, IOrmLiteDialectProvider dialectProvider, IDataReader reader, Tuple`3[] indexCache, Object[] values)

1 个答案:

答案 0 :(得分:0)

错误消息表明您的数据库中有脏数据,它会尝试将某些内容强制转换为不长的数据。

检查您的数据并确保您的POCO与您的表架构匹配,问题可能在category_id或其他地方。