Upgrading to latest Cofoundry, Custom Entity routes wrong
mcockrellsana opened this issue · comments
Hello!
We've recently upgraded to .net6 and the latest cofoundry (all the way from older versions a year or two back).
The biggest issue i'm seeing that I'm confused on how to resolve is that all our custom entities, seem to be routed to /admin/{ID}
When in reality they should be generated the same as they were before, unless there's a new configuration I'm unaware of!
In this case below, it should be routing to /schools/{ID} or at least /school/{ID} - but it is /admin/{ID} when i try to browse to the page for the custom entity, and 404s nonetheless.
None of the code changed for the custom entities themselves, here's a sample:
public class SchoolEntityDefinition : ICustomEntityDefinition<SchoolDataModel>, ICustomizedTermCustomEntityDefinition
{
/// <summary>
/// This constant is a convention that allows us to reference this definition code
/// in other parts of the application (e.g. querying)
/// </summary>
public const string DefinitionCode = "SCHOOL";
/// <summary>
/// Unique 6 letter code representing the module (the convention is to use uppercase)
/// </summary>
public string CustomEntityDefinitionCode => DefinitionCode;
/// <summary>
/// Singlar name of the entity
/// </summary>
public string Name => "School";
/// <summary>
/// Plural name of the entity
/// </summary>
public string NamePlural => "Schools";
/// <summary>
/// A short description that shows up as a tooltip for the admin
/// panel.
/// </summary>
public string Description => "Data model for a School";
/// <summary>
/// Indicates whether the UrlSlug property should be treated
/// as a unique property and be validated as such.
/// </summary>
public bool ForceUrlSlugUniqueness => true;
/// <summary>
/// Indicates whether the url slug should be autogenerated. If this
/// is selected then the user will not be shown the UrlSlug property
/// and it will be auto-generated based on the title.
/// </summary>
public bool AutoGenerateUrlSlug => true;
/// <summary>
/// Indicates whether this custom entity should always be published when
/// saved, provided the user has permissions to do so. Useful if this isn't
/// the sort of entity that needs a draft state workflow
/// </summary>
public bool AutoPublish => false;
/// <summary>
/// Indicates whether the entities are partitioned by locale
/// </summary>
public bool HasLocale => false;
public Dictionary<string, string> CustomTerms => new Dictionary<string, string>()
{
{ CustomizableCustomEntityTermKeys.Title, "School Name"}
};
}
Just a note, I think I MAY have resolved this, but testing further.
I think the issue was with an older CustomEntityRoutingRule, I applied the new code from the new examples and it seems ok, will report back.
I can't think of anything offhand that changed in that area, but let me know if the issue persists.
Refactoring the CustomEntityRoutingRule seemed to have fixed it, using newer examples. Apologies for the false report!