-
Notifications
You must be signed in to change notification settings - Fork 933
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
Do not store mapping field in Configuration #3398
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1c40dde
Do not store mapping in Configuration
hazzik ee07fe2
Create settings before mappings
hazzik 5329091
Throw invalid operation exception if dialect is not ready yet
hazzik e17be07
Make DeepSource happy
hazzik 92ad468
Remove reflection from tests
hazzik ddbb057
Refactoring
hazzik 8a625cb
Merge branch 'master' of https://github.com/nhibernate/nhibernate-cor…
hazzik bfb30a3
Obsolete BuildMapping method
hazzik 02052af
Oops
hazzik 6390400
Remove validation on serialization
hazzik 9f81860
Code review changes
hazzik 92b008a
Merge branch 'master' of https://github.com/nhibernate/nhibernate-cor…
hazzik 13cf540
Remove whitespace churn
hazzik 16a9d50
Encapsulate StaticDialectMappingWrapper instantiation
hazzik 08e4354
Improve obsolescence message
hazzik b632e60
Merge branch 'master' into refactor-cfg
hazzik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The true equivalent for the original code in the new way would be
GetMapping(Configuration cfg) => cfg.BuildMapping()
, butDialect
would throw anInvalidOperationException
. However, in this case it does not matter and we can use fully resolved session factory instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now new public "BuildMapping" can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about it and don't like it.
cfg.BuildMapping
just should not exist as it provides an incomplete version of mapping, that can create a lot of problems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't understand your concern. In my understanding
IMapping
was specifically designed to be safely used in "uncompiled" state. See interface description:nhibernate-core/src/NHibernate/Engine/IMapping.cs
Lines 6 to 7 in a0bc61f
So as long you use interface methods and don't do some funny castings you should be safe.
You agreed to keep method public - so it would be good to have it in tests too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the
IMapping
was designed. It was probably appeared incidentally from some other bad design decision. Problem with the interface that it is not clear when it is safe to use compiled or raw mappings. For example,SingleTableEntityPersister
accepts bothIMapping
andISessionFactoryImplementor
. Can it use onlyISessionFactoryImplementor
?nhibernate-core/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs
Lines 79 to 81 in 3e353c1
This is really not clear.
Also, Hibernate has removed this interface and redesigned the mapping compilation.