Added BsonRefId<T> to allow explicit DbRefs in LINQ expressions#2741
Conversation
This document outlines the Code of Conduct for community members, detailing pledges, standards of behavior, enforcement responsibilities, and consequences for violations.
Updated build status badge and added pre-release badge.
…ressions_with_dbref # Conflicts: # LiteDB/Client/Mapper/Linq/LinqExpressionVisitor.cs
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a046a5be5c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2df20d84d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// <summary> | ||
| /// Is this property an DbRef? Must implement Serialize/Deserialize delegates | ||
| /// </summary> | ||
| public bool IsDbRef { get; set; } | ||
| public bool IsDbRef => DbRefCollectionName != null; |
There was a problem hiding this comment.
Restore public DbRef configuration for custom mappers
The commit makes MemberMapper.IsDbRef read-only and ties it to the new internal DbRefCollectionName, which means external code can no longer mark a member as a DbRef in ResolveMember or other custom mapping hooks. This is a breaking change for consumers who previously set member.IsDbRef = true (and optionally supplied custom serialize/deserialize) without using [BsonRef] or EntityBuilder.DbRef. Because DbRefCollectionName is internal, there is now no public way to achieve the same configuration, so existing mapping code will fail to compile or silently lose DbRef behavior. Consider keeping a public setter or exposing a public way to set the collection name.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@JKamsker How to handle this? I understand the point, but don't see how to just set the IsDbRef flag (in ResolveMember?) would lead to something useful. Doing this manual currently requires also to set a pretty complex Serialize/Deserialize method. I would even go further and try to make the Entity/Member mappers themselves internal, letting the generic ResolveMember method use some builder approach like it exists for the EntityBuilder.
|
Thanks for the pr! |
With this PR, a LINQ expression helper type
BsonRefId<T>is introduced that allows explicit setting of DbRef objects in LINQ expressions, for example inUpdateMany.Resolves #2739