ardalis / ardalis/SmartEnum

ConfigureSmartEnum not working

Open
#554 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
184
PR merge metrics
No merged PRs in 30d

Description

**this is my ConfigureConventions**
![image](https://github.com/user-attachments/assets/d3fd71b8-19b2-498f-817d-0817f33d02d8)

**The smart enum**
![image](https://github.com/user-attachments/assets/578f6d39-fe22-4291-99c3-deb0db758e64)

**How I use it under entity**
![image](https://github.com/user-attachments/assets/ba4f4c5c-831f-4b75-b46f-706518b8fc2a)

`The exception 'No suitable constructor was found for entity type 'UnitMaterial'. The following constructors had parameters that could
not be bound to properties of the entity type:
Cannot bind 'name', 'value' in 'UnitMaterial(string name, int value)'`

how can I fix this ? please help
UnitMaterial and Entity is under my DOMAIN project, and dbContext is under INFRASTRUCTURE project

My specs
.NET 8.0
SmartEnum 8.1
SmartEnum.EFCore 8.1

Contributor guide

Open the contributing guide

Research direction

Start with the ConfigureConventions setup, the UnitMaterial entity, and the DbContext described in the issue, then reproduce the constructor-binding exception using SmartEnum 8.1 and SmartEnum.EFCore 8.1 on .NET 8. Check the SmartEnum.EFCore mapping entry points and verify that UnitMaterial can be discovered and persisted without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.