使用session.context(ctx)方法后会覆盖原有的ctx,拿不到session_id #2052
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#2052
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
初始化
engine
的时候可以设置EnableSessionID
这个开关会在后面
newSession
的使用来初始化session
里面的ctx
,并放入log.SessionIDKey
和log.SessionKey
。这里本意应该是在后面的时候可以使用ctx来获取SessionID
和SessionKey
(比如LoggerAdapter
)但是如果使用
session
的时候,使用了session
的Context(ctx)
方法传入了上下文的context,就会直接覆盖,导致需要取SessionKey
的地方取不到。下面的是session.Context()
方法可以在使用了
session
的Context(ctx)
方法的时候,将原有的值拷贝一份到传入的ctx中去,而不是覆盖可以解决此问题Could you send a PR to fix this?
ok, pr created, ref: #2053