CodeFluent Entities JSON序列化问题及属性设置咨询
Let's cut to the chase: CodeFluent Entities automatically injects a TypeConverterAttribute into your entities, which uses the EntityDisplayName property to convert entities to strings. The problem? Json.NET picks up this attribute and uses it to serialize your entities as plain strings instead of the full JSON object structure you'd expect.
Here are two proven ways to fix this:
1. Disable the Runtime Design Attribute (Quick Fix)
If you don't use the type converter functionality at all, this is the simplest solution:
- In your CodeFluent Entities project, find the Add Runtime Design Attribute setting and set it to
False. This will stop the framework from adding that problematic attribute to your generated classes, and Json.NET will serialize entities normally again.
2. Use Json.NET Aspects to Override Serialization
If you still need the type converter for other scenarios, you can use CodeFluent's Json.NET aspects to generate Json.NET-specific attributes (like [JsonConverter] or [JsonObject]) on your classes/properties.
A heads-up: Official docs for this are hard to come by right now. The old blog site is offline, the main site's knowledge center only covers basic questions, and you might have to rely on Google's
site:syntax to hunt down any existing examples.
A Note on Support & Community
It's no secret that CodeFluent's support resources are stretched thin these days:
- The main SoftFluent site's FAQ and blog are lacking in depth, and there's no built-in search for their content. The knowledge center only returns basic results, so custom searches are often necessary.
- While the official line is to post questions on Stack Overflow with the
codefluenttag, the community isn't very active, and the key maintainer @meziantou is currently swamped with work.
As someone who's relied on this tool for years, I totally get your concern about the project's future. Dealing with those expiring free licenses that require online renewal always makes me hold my breath—here's hoping the servers stay up and the project keeps going.
内容的提问来源于stack exchange,提问作者Josep Alacid

