-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strong type App Settings and Resources #3539
Comments
Actually this already exists ;) If you auto-generate the base classes (in the co-pilot of the views) the resulting It looks a bit like this namespace AppCode.Razor
{
/// <summary>
/// Base Class for Razor Views which have a typed App but don't use the Model or use the typed MyModel.
/// </summary>
public abstract partial class AppRazor: AppRazor<object>
{
}
/// <summary>
/// Base Class for Razor Views which have a typed App and a typed Model
/// </summary>
public abstract partial class AppRazor<TModel>: Custom.Hybrid.RazorTyped<TModel>
{
/// <summary>
/// Typed App with typed Settings & Resources
/// </summary>
public new IAppTyped<AppSettings, AppResources> App => _app ??= Customize.App<AppSettings, AppResources>();
private IAppTyped<AppSettings, AppResources> _app;
}
} To use this, simply inherit from that class. Enjoy ;) |
Sorry. Can you provide a clear example on the lines of code needed? For inherit and values. |
Sure. Check out some examples on the Blog app. This search will get you a few files that then use https://github.com/search?q=repo%3A2sic%2Fapp-blog+apprazor+app.resources&type=code |
I'm submitting a
[x] feature request
...about
[x] Content Types or data management
Current Behavior / Expected Behavior
We have strong typing for data through copilot, but not for app settings and resources.
Please implement :)
The text was updated successfully, but these errors were encountered: