SQL Server的ASP.NET Core 3.1数据库上下文添加一个十进制值,结果是该值的10倍

问题描述

我有一个正在工作的ASP.NET Core项目,正在sql Server中记录一个十进制值。

在“开发”环境中,我有一个sqlite数据库,并且在那里可以正常进行添加

当我使用sql Server 2017实例过渡到生产时,插入(示例)8.0m会导致记录已写入80。

这可能是什么原因?

解决方法

我找到了解决方法。

public static void main(String[] args) throws IOException {
    Path dir        = Path.of(args[0]);
    Path ignoreFile = Path.of(args[1]);

    HashSet<Path> ignore = new HashSet<Path>();
    ArrayList<Path> fileList = new ArrayList<Path>();

    try(Stream<String> stream = Files.lines(ignoreFile)) {
        stream.map(Path::of).forEach(ignore::add);
    }
    try(Stream<Path> stream = Files.list(dir)) {
        stream.filter(p -> !ignore.contains(p) && !ignore.contains(p.getFileName()))
              .forEach(fileList::add);
    }
    System.out.println("Files#"+fileList.size()+' '+fileList);
  }

这是我以前的代码,显然对于没有提供程序的SQL Server来说,解析是不正确的。 嗯,我改成了这个。

Hours = decimal.Parse(hours);

这似乎解决了我的问题。