dotnetcore / dotnetcore/FreeSql
联合主键中有datetime类型时update出现异常
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 910
- PR merge metrics
- No merged PRs in 30d
Description
#### 问题描述及重现代码:
使用泛型仓储保存联合主键中含有datetime类型的对象时,触发Can't write CLR type System.DateTime with handler type TextHandler异常,insert没有问题。 数据库类型为timestamp
```c#
///
/// 流水号分配表
///
public class Serial
{
///
/// 业务类型前缀
///
[Column(IsPrimary = true)]
public string BizTypePrefix { get; private set; }
///
/// 日期
///
[Column(IsPrimary = true)]
public DateTime Date { get; private set; }
///
/// 最后使用流水号
///
public int LastValue { get; private set; }
}
public class SerialRepository : ISerialRepository
{
private readonly IBaseRepository _serialRepository;
public SerialRepository(IBaseRepository serialRepository)
{
_serialRepository = serialRepository;
}
///
/// 保存
///
///
///
[Transactional]
public Task SaveAsync(Serial serial, CancellationToken cancellationToken = default)
{
return _serialRepository.InsertOrUpdateAsync(serial, cancellationToken);
}
[Transactional]
public Task UpdateAsync(Serial serial, CancellationToken cancellationToken = default)
{
return _serialRepository.UpdateAsync(serial, cancellationToken);
}
}
// c# code
```
#### 数据库版本
postgres (PostgreSQL) 16.4
#### 安装的Nuget包
FreeSql.Provider.PostgreSQL 3.5.209
#### .net framework/. net core? 及具体版本
.net 8
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.