Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.1版本之后使用SetSource更新数据报错 #521

Closed
wzohxia opened this issue Nov 5, 2020 · 8 comments
Closed

1.8.1版本之后使用SetSource更新数据报错 #521

wzohxia opened this issue Nov 5, 2020 · 8 comments

Comments

@wzohxia
Copy link

wzohxia commented Nov 5, 2020

var item = new List<Users>();

item.Add(new Users { ID = 1000000000000000001, SpellCode = "ces",Version=1 });

await _freeSql.Update<Users>().SetSource(item).UpdateColumns(info=>info.SpellCode).ExecuteAffrowsAsync();

image

v1.8.1不会报错 1.8.1以上的版本会报错

@2881099
Copy link
Collaborator

2881099 commented Nov 5, 2020

实体类发一下,报的什么错

@wzohxia
Copy link
Author

wzohxia commented Nov 5, 2020

我试了实体类标签

 [Key]
        public long ID { get; set; }

        [Description("名字")]
        public string Name { get; set; }

        [Description("账号")]
        [Column(IsNullable = false)]
        public string Account { get; set; }

        [Description("名称拼音首字母")]
        public string SpellCode { get; set; }

        [Description("乐观锁")]
        [Column(IsVersion = true, InsertValueSql = "1")]
        public long Version { get; set; }

如果 [Column(IsNullable = false)] 不使用就不会报错 使用了就会报错

2881099 added a commit that referenced this issue Nov 5, 2020
@2881099
Copy link
Collaborator

2881099 commented Nov 5, 2020

@wzohxia
Copy link
Author

wzohxia commented Nov 6, 2020

 fsql.Aop.AuditValue += (s, e) => {
                if (e.Column.CsType == typeof(long)
                    && e.Property.GetCustomAttribute<SnowflakeAttribute>(false) != null
                    && e.Value?.ToString() == "0") {
                    e.Value =1;
                }
                
            };

我扩展了Aop 增加了SnowflakeAttribute 标签判断 去除这段就不会报错 增加了就会产生上述问题

@2881099
Copy link
Collaborator

2881099 commented Nov 6, 2020

问题重现了,确实是个 bug,是 1.8.1 改出来的

@wzohxia
Copy link
Author

wzohxia commented Nov 6, 2020

好的

@2881099
Copy link
Collaborator

2881099 commented Nov 6, 2020

8eadde9

bug 这个时候产生的。准备发布 1.8.2、1.9.1、1.10.2 修复该问题。

@2881099
Copy link
Collaborator

2881099 commented Nov 6, 2020

1.8.2、1.9.1、1.10.2 和当前 2.0.0-preview 最新版本一样

2881099 added a commit that referenced this issue Nov 6, 2020
2881099 added a commit that referenced this issue Nov 6, 2020
2881099 added a commit that referenced this issue Nov 6, 2020
2881099 added a commit that referenced this issue Nov 6, 2020
2881099 added a commit that referenced this issue Nov 6, 2020
2881099 added a commit that referenced this issue Nov 24, 2020
@2881099 2881099 closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants