Issues with updatable views

Sample database script:

CREATE TABLE Test.T(ID int IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED, D date)
GO
CREATE VIEW Test.TView AS SELECT ID,D,(SELECT MAX(D) FROM Test.T AS L WHERE L.ID<=T.ID) AS Z FROM Test.T AS T
GO
INSERT INTO Test.TView(D) VALUES('4/4/2026');
UPDATE Test.TView SET D='2/2/2026' WHERE D='4/4/2026';

To reproduce errors, create new project in ANM 2026.3

  1. Uncheck table T
  2. Click Tables
  3. Under view TView, check Add page and Edit page. Click OK if warning appears, in this case, the database allows the view to be updated as proven by last two SQL statements.
  4. On TView, Fields tab, column Z is correctly unchecked for Edit and Add by default because ANM knows it can't be changed.
  5. Generate

Issue 1: When trying to add, errors appear:

Update or insert of view or function 'Test.TView' failed because it contains a derived or constant field.

Although that is true, it can work perfectly fine as long as it doesn't try to change the derived or constant field. It normally doesn't try since it can detect read-only fields when synchronizing with the database. We have been successfully editing views for years since our users need to see additional info when working in the databases. Usually the derived fields look up information in other tables but I made the example very simple.

If you create the same project in ANM 2020 or 2022, Add and Edit work perfectly fine (in v2022, I have to re-choose a theme to generate a new project). I'm guessing any version will work before Entities were added, or perhaps some other change that broke it. I was able to get this to work by adding Z.IsCustom=true; to Page_Load. I could add that to all the derived fields in all the views in all our databases. I can think of two ways ANM could handle this as well as it used to, hopefully easily: either set IsCustom or something similar for the fields it detects can't be changed when synchronizing with the database, like it unchecks Add and Edit in the UI for those fields, or perhaps the Add code isn't supposed to be adding all fields, only fields that were specified on the add page. The Edit page is still correctly checking which fields need to be updated (skipping derived fields), once the below issues are fixed, so maybe the Add page should use the same algorithm as the Edit page.

Issue 2: I don't know why the Edit page isn't even generated and the Edit button doesn't appear in the new 2026 project, even when I make sure Edit is checked on TView.

Issue 3: If you create this project in 2022 (or probably others) and open it in 2026, the Edit button appears, but trying to save an edit causes the error:

Exception: Class for entity 'Tview' does not exist.

We tracked this down to Entities\Tview.cs. Near the top it has [Table("TView")]. If I change that to [Table("TView2")], the Edit page works just like it did in 2020 or 2022. The same code is in Models\TView2.cs, but changing it there didn't seem to have any effect. Even though the table T is not generated, it seems to think T will have a View page called TView that conflicts with the database view TView, so it renames the view to TView2 but appears to have missed using the renamed name in the Table attribute. I am guessing this could happen with other renamed tables, so perhaps the template needs to be checked.