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

FreeSql.Generator生成实体主键没有IsPrimary #182

Closed
fishjimi opened this issue Jan 10, 2020 · 11 comments
Closed

FreeSql.Generator生成实体主键没有IsPrimary #182

fishjimi opened this issue Jan 10, 2020 · 11 comments

Comments

@fishjimi
Copy link

@fishjimi fishjimi commented Jan 10, 2020

如果主键是自增的
属性中会有 IsIdentity = true
但是主键属性没有生成 IsPrimary= true
导致 _fsql.Update().SetSource(entity).ExecuteAffrows();会报错

@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 10, 2020

收到,报什么错。

本来是想减少特性生成的,因为有约定主键。

约定:

当没有指明主键时,命名为 id 的字段将成为主键;(不区分大小写)

当没有指明主键时,自增列属性,会成为主键

@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 10, 2020

追问一下,使用的是什么数据库

@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 10, 2020

检查发现,DbFirst 获取 Primary 信息失败了。。最近的版本出现的,我修复一下

@fishjimi

This comment has been minimized.

Copy link
Author

@fishjimi fishjimi commented Jan 10, 2020

因为一些特殊情况我没有用约定ID
比如有时候指定了双主键,所以还是挺需要自动生成的

@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 10, 2020

这个问题是 去年 10.3 号增加索引 CodeFirst 改出来的 bug
问题已修复,还有个问题解决了再发布版本

@fishjimi

This comment has been minimized.

Copy link
Author

@fishjimi fishjimi commented Jan 10, 2020

好的,谢谢效率哥!

@fishjimi fishjimi closed this Jan 10, 2020
2881099 pushed a commit that referenced this issue Jan 10, 2020
@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 10, 2020

dotnet tool install --global FreeSql.Generator --version 1.1.0-preview4-2

用这个更新命令工具,后面要加版本

@yezi34880

This comment has been minimized.

Copy link

@yezi34880 yezi34880 commented Jan 17, 2020

sqlserver,主键名不叫ID,类型为字符串,但数据库设置了主键,dbfirst获取列时IsPrimary=false

@2881099 2881099 reopened this Jan 17, 2020
@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 17, 2020

sqlserver,主键名不叫ID,类型为字符串,但数据库设置了主键,dbfirst获取列时IsPrimary=false

dotnet tool update --global FreeSql.Generator --version 1.1.0-preview4-2

更新一下工具

@2881099 2881099 closed this Jan 17, 2020
@yezi34880

This comment has been minimized.

Copy link

@yezi34880 yezi34880 commented Jan 19, 2020

sqlserver,主键名不叫ID,类型为字符串,但数据库设置了主键,dbfirst获取列时IsPrimary=false

dotnet tool update --global FreeSql.Generator --version 1.1.0-preview4-2

更新一下工具

谢谢,下个版本啥时候发呀?

@2881099

This comment has been minimized.

Copy link
Owner

@2881099 2881099 commented Jan 19, 2020

sqlserver,主键名不叫ID,类型为字符串,但数据库设置了主键,dbfirst获取列时IsPrimary=false

dotnet tool update --global FreeSql.Generator --version 1.1.0-preview4-2
更新一下工具

谢谢,下个版本啥时候发呀?

每个月发一个正式版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.