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

Z.EntityFramework.Plus.EFCore - Official behavior on DataAnnotations ? #583

Closed
jsparent opened this issue May 19, 2024 · 1 comment
Closed

Comments

@jsparent
Copy link

Description

We are using the commercial version of Z.EntityFramework.Plus.EFCore and using a lot of

  • BulkInsertAsync()
  • BulkUpdateAsync()
  • BulkDeleteAsync()
  • BulkSynchronizeAsync()

We were under the impression that ZEntity was validating each model and their DataAnnotation before saving, like EF Core does. We had an edge case where the database column would allow NULL (for legacy purpose) but the EF Model was declared as

  [Required] // Here we want to simulate a DB that allows null but marked as required on the model
  public int? NullableInt { get; set; }

To our surprise, the Bulk methods would allow invalid values (null) to reach the database. I just want to validate your official position regarding DataAnnotations. Should we validate each object manually before calling Bulk() methods or is that something that should be handled by ZEntity Bulk() methods ?

Thanks for your time!

Further technical details

  • .NET Core 8
  • EF Core v8.0.5
  • Z.EntityFramework.Plus.EFCore: [v8.102.2.4]
  • Database Server version: [SQL Server 2022]
@jsparent
Copy link
Author

Wrong repo, my bad, moved to zzzprojects/EntityFramework-Plus#798

@jsparent jsparent closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant