-
-
Notifications
You must be signed in to change notification settings - Fork 403
Call data portal operation methods explicitly #4359
Copy link
Copy link
Open
Description
Today, data portal operation methods are private and are called dynamically by the data portal. They are identified by attributes such as Fetch or Update.
This is a problem because AOT will optimize these methods out of the codebase. It is also a problem because Visual Studio grays out the code, thinking it is never invoked.
Using a code generator, it might be possible to explicitly invoke these methods. Here are my initial thoughts on how such a thing might work.
- A generator can look at the code and identify all data portal operation methods
- The generator can create an interface that includes all the methods, and code to implement the interface explicitly - invoking the actual methods
- The server-side data portal can be changed to detect this interface, and if it exists, to use the interface for invoking methods instead of invoking the private methods (which may provide slight performance improvement)
For example:
public partial class PersonEdit : BusinessBase<PersonEdit>
{
public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(nameof(Name));
public string Name
{
get => GetProperty(NameProperty);
set => SetProperty(NameProperty, value);
}
[Fetch]
private void Fetch(string name)
{
LoadProperty(NameProperty, name);
}
}
// generated code:
public interface IPersonEditOperations
{
void Fetch(string name);
}
public partial class PersonEdit : IPersonEditOperations
{
void IPersonEditOperations.Fetch(string name) => Fetch(name);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
In Progress