-
Notifications
You must be signed in to change notification settings - Fork 686
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
Updating an entity that violates a unique constraint gives no indication the violation occurred #355
Comments
@kgreen24 sorry I haven't seen that issue sooner. What does NHibernate people say about this? Something tells me it's not a fluent problem |
FluentNHibernate is a mapping generator tool. Not the ORM itself. Please post on the nhusers group with requested details. |
I know the fluent Nhibernate is a mapping generator tool. Not the NORM itself. but the problem still occurring just when using the fluent Nhibernate. and your response does not help in anything |
Nevertheless, it's unlikely to be a problem in FluentNHibernate.
still occurring just when using the fluent Nhibernate.
"Just when".. Are you actually saying that the problem doesn't occur if you
do the same mapping using some other mapping API? Though for now I suspect
that it was an unintended implication.
I suspect the problem isn't in NHibernate either. The constraint is checked
by the database software. And this is very common functionality, it would
at least be very surprising for that not to work.
I think a more likely explanation could be that the update isn't actually
flushed to the database, because for whatever reason your code doesn't do
anything that will trigger the flush. Or secondly, that there is an
exception but your code somewhere catch and drop it.
…On Thu, 6 Jan 2022, 00:12 Michael Rodrigues, ***@***.***> wrote:
I know the fluent Nhibernate is a mapping generator tool. Not the NORM
itself. but the problem still occurring just when using the fluent
Nhibernate. and your response does not help in anything
—
Reply to this email directly, view it on GitHub
<#355 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADVWLZTTF5G6ZEI4XOF2H3UUTF7LANCNFSM4CNYIINA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I have an entity that has a unique constraint on a name property:
Map(x => x.Name).Unique();
My backing database is SQL Server 2014.
When I try to add a new record with a name that already exists in the db, I get a nice exception that I can catch and deal with. However, if I update an entity with the name of an already existing entity and try to persist it, there is no exception thrown anywhere or otherwise any indication given that the constraint was violated. Code execution continues as normal, and the row in the db is just not updated.
There should be a way to catch and deal with constraint violation errors on update as there is with add.
The text was updated successfully, but these errors were encountered: