Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ef840f6
Initial plan
Copilot Feb 14, 2026
8468dc5
Add support for block-bodied methods with common statements
Copilot Feb 14, 2026
f68c572
Add functional tests and documentation for block-bodied methods
Copilot Feb 14, 2026
7067bc2
Add support for if-without-else and switch statements
Copilot Feb 14, 2026
75c638e
Address code review feedback
Copilot Feb 14, 2026
7a70fde
Merge branch 'master' into copilot/support-classic-methods-transforma…
PhenX Feb 15, 2026
06627c2
Remove unused code and add support for multiple early returns
PhenX Feb 15, 2026
9add2c9
Missing verify files
PhenX Feb 15, 2026
3c91bf9
Update docs
PhenX Feb 15, 2026
e2b1fad
Address code review feedback - fix semantics and scoping issues
Copilot Feb 15, 2026
f7f296b
Improve switch expression support and improve variable handling
PhenX Feb 15, 2026
3b56faa
Remove redundant code and add test for projectables in block bodied m…
PhenX Feb 15, 2026
ff4feb1
Fix new case
PhenX Feb 15, 2026
7ba8a84
Fix local variable replacement in conditions and switch expressions
Copilot Feb 16, 2026
b8af892
Improve error reporting for side effects in block-bodied methods
Copilot Feb 16, 2026
b697cd2
Add documentation for side effect detection
Copilot Feb 16, 2026
f2a805e
Initial exploration - understand pattern matching crash issue
Copilot Feb 16, 2026
31f4267
Fix pattern matching support in block-bodied methods
Copilot Feb 16, 2026
adc95f5
Add documentation for pattern matching support
Copilot Feb 16, 2026
5f83f40
Revert pattern matching commits to separate feature
Copilot Feb 16, 2026
8b144b5
Address code review suggestions and update documentation
Copilot Feb 16, 2026
2b70d43
Update block bodied release number
PhenX Feb 16, 2026
b4989af
Reveret change about if with single return
PhenX Feb 16, 2026
a741a27
Mark this new feature as experimental and allow explicit getters for …
PhenX Feb 18, 2026
3788729
Fix block bodied properties
PhenX Feb 18, 2026
f2d0ec8
Simplify code and add xmldocs
PhenX Feb 18, 2026
9b7e61a
Handle code review suggestions and fix an operator precedence issue w…
PhenX Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,39 @@ GROUP BY (COALESCE("u"."FirstName", '') || ' ') || COALESCE("u"."LastName", '')
ORDER BY (COALESCE("u"."FirstName", '') || ' ') || COALESCE("u"."LastName", '')
```

#### Can I use block-bodied members instead of expression-bodied members?

Yes! As of version 6.x, you can now use traditional block-bodied members with `[Projectable]`. This makes code more readable when dealing with complex conditional logic:

```csharp
// Expression-bodied (still supported)
[Projectable]
public string Level() => Value > 100 ? "High" : Value > 50 ? "Medium" : "Low";

// Block-bodied (now also supported!)
[Projectable(AllowBlockBody = true)] // Note: AllowBlockBody is required to remove the warning for experimental feature usage
public string Level()
{
if (Value > 100)
return "High";
else if (Value > 50)
return "Medium";
else
return "Low";
}
```

> This is an experimental feature and may have some limitations. Please refer to the documentation for details.

Both generate identical SQL. Block-bodied members support:
- If-else statements (converted to ternary/CASE expressions)
- Switch statements
- Local variables (automatically inlined)
- Simple return statements

The generator will also detect and report side effects (assignments, method calls to non-projectable members, etc.) with precise error messages. See [Block-Bodied Members Documentation](docs/BlockBodiedMembers.md) for complete details.


#### How do I expand enum extension methods?
When you have an enum property and want to call an extension method on it (like getting a display name from a `[Display]` attribute), you can use the `ExpandEnumMethods` property on the `[Projectable]` attribute. This will expand the enum method call into a chain of ternary expressions for each enum value, allowing EF Core to translate it to SQL CASE expressions.

Expand Down
Loading