mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
support for rewriting null conditional access expressions
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
namespace EntityFrameworkCore.Projectables
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures how null-conditional operators are handeled
|
||||
/// </summary>
|
||||
public enum NullConditionalRewriteSupport
|
||||
{
|
||||
/// <summary>
|
||||
/// Don't rewrite null conditional operators (Default behavior).
|
||||
/// Usage of null conditional operators is thereby not allowed
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// Ignore null-conditional operators in the generated expression tree
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <c>(A?.B)</c> is rewritten as expression: <c>(A.B)</c>
|
||||
/// </remarks>
|
||||
Ignore,
|
||||
|
||||
/// <summary>
|
||||
/// Translates null-conditional operators into explicit null checks
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <c>(A?.B)</c> is rewritten as expression: <c>(A != null ? A.B : null)</c>
|
||||
/// </remarks>
|
||||
Rewrite
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,6 @@ namespace EntityFrameworkCore.Projectables
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class ProjectableAttribute : Attribute
|
||||
{
|
||||
public NullConditionalRewriteSupport NullConditionalRewriteSupport { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user