2sic / 2sxc

DNN + 2sxc = #DNNCMS - This tool helps web designers and developers prepare great looking content in DNN (DotNetNuke). It's like mixing DNN with Umbraco and Drupal :)
http://2sxc.org
MIT License
145 stars 40 forks source link

Bug: Renaming a Content-Type Leaves Unusued AppCode Generated Class Files #3464

Closed jeremy-farrance closed 2 months ago

jeremy-farrance commented 2 months ago

I'm submitting a

[x] bug report

...about

[x] admin experience UI [x] Razor templating [x] Content Types or data management

Current Behavior / Expected Behavior

Copilot Generated AppCode classes only create and overwrite *.Generated.cs files. So when a Content-Type or View is deleted or renamed the generated files are left behind. This causes issues in IntelliSense as well as confusion with already written code that needs to be updated (due to a rename).

If the ghost classes go unnoticed, the wrong CT class can get used leading to a very confusing debugging session for 1 or more people.

Currently, using Copilot is not automatic: when you make changes to Content Types they do not automatically update. So I believe it would be best if the cleanup happened WHEN the CT was renamed or deleted.

Conversely, if Copilot class generation was reliably automatic (on any CT addition, change, or delete), then it might make sense to purge unneeded *.Generated.cs files in the context of Copilot Generation.

Instructions to Reproduce the Problem

  1. Create a Content-Type
  2. Use Copilot to Generate
  3. Delete or Rename the CT from 1
  4. Use Copilot to Generate
  5. In the AppCode/Data folders, the *.Generated.cs file for the CT from 1 will still be there

Your environment

iJungleboy commented 2 months ago

There is a lot of complexity to this, both for automatic clean-up (as content-types are renamed/removed) as well triggered-on-generate.

One of the factors which increases complexity is the fact that you can generate into multiple editions, so it would not be clear which ones should be cleaned.

On manual generate it would have to show UIs to inform the developer that it wants to do this etc.

So the simplest method (on generate - UI for developer) would easily need 4h of development.

the more automatic ones are currently out of reach, since it's not clear which edition should be affected.

So in general: lots of work, and I don't think anybody is willing to contribute this. if someone wants to do it, great, but since I assume nobody will do it, I'll close this after tagging.