Existing Blazor WASM App, successfully builds in both Radzen Blazor Studio and Visual Studio Community 2022.
I'm trying to add a new database table, then add it to my application, but I get build errors after adding it.
I've created a table in SQL Server:
CREATE TABLE [dbo].[Test1Lead](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Date_Created] [date] NOT NULL,
[Street] [varchar](50) NOT NULL,
[City] [varchar](50) NOT NULL,
[State] [varchar](2) NOT NULL,
[Zip] [int] NOT NULL,
CONSTRAINT [PK_TestLead1] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
I then go to "Data" in studio:
- Choose existing DB connection
- Click Next
- Uncheck "Overwrite existing files"
- Expand Tables
- Select my new table (leaving all existing tables checked)
- Uncheck "Cascade delete
- Check "Optimistic concurrency"
- Click Next
- Click "Generate pages for CRUD operations"
- CRUD type pages selected
- Click Next
- Uncheck "Overwrite existing files"
- Expand entities, ensure all are selected including new one
- Check "Search as you type"
- Check "Enable reload on optimistic concurrency error"
- Click Finish
Result:
The build in Blazor Studio fails:
Building...
C:\Users\Don\code\wep.westelmcrm\Client\Pages\Test1Leads.razor.cs(56,62): error CS1061: 'WestElmCRMTenantDBService' does not contain a definition for 'GetTest1Leads' and no accessible extension method 'GetTest1Leads' accepting a first argument of type 'WestElmCRMTenantDBService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
C:\Users\Don\code\wep.westelmcrm\Client\Pages\Test1Leads.razor.cs(58,32): error CS0428: Cannot convert method group 'Count' to non-delegate type 'int'. Did you intend to invoke the method? [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
C:\Users\Don\code\wep.westelmcrm\Client\Pages\Test1Leads.razor.cs(84,72): error CS1061: 'WestElmCRMTenantDBService' does not contain a definition for 'DeleteTest1Lead' and no accessible extension method 'DeleteTest1Lead' accepting a first argument of type 'WestElmCRMTenantDBService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
C:\Users\Don\code\wep.westelmcrm\Client\Pages\AddTest1Lead.razor.cs(46,62): error CS1061: 'WestElmCRMTenantDBService' does not contain a definition for 'CreateTest1Lead' and no accessible extension method 'CreateTest1Lead' accepting a first argument of type 'WestElmCRMTenantDBService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
C:\Users\Don\code\wep.westelmcrm\Client\Pages\EditTest1Lead.razor.cs(40,57): error CS1061: 'WestElmCRMTenantDBService' does not contain a definition for 'GetTest1LeadById' and no accessible extension method 'GetTest1LeadById' accepting a first argument of type 'WestElmCRMTenantDBService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
C:\Users\Don\code\wep.westelmcrm\Client\Pages\EditTest1Lead.razor.cs(49,62): error CS1061: 'WestElmCRMTenantDBService' does not contain a definition for 'UpdateTest1Lead' and no accessible extension method 'UpdateTest1Lead' accepting a first argument of type 'WestElmCRMTenantDBService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
C:\Users\Don\code\wep.westelmcrm\Client\Pages\EditTest1Lead.razor.cs(79,57): error CS1061: 'WestElmCRMTenantDBService' does not contain a definition for 'GetTest1LeadById' and no accessible extension method 'GetTest1LeadById' accepting a first argument of type 'WestElmCRMTenantDBService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\Don\code\wep.westelmcrm\Client\WestElmCRM.Client.csproj]
The build failed. Fix the build errors and run again.
The build also fails in Visual Studio.
Doing a "git status" here are the changes:
./Client/Shared/MainLayout.razor:
- the new table is added to the menu, but Razor also readds all the existing pages that I've manually removed.
./Server/Program.cs
- one command is slightly reformatted, but no actual change to it
- adds the entity set for new table:
oDataBuilderWestElmCRMTenantDB.EntitySet<WestElmCRM.Server.Models.WestElmCRMTenantDB.Test1Lead>("Test1Leads");
./Server/WestElmCRM.Server.csproj
- updates the OpenXML version, no impact
Pages added:
- Client/Pages/AddTest1Lead.razor
- Client/Pages/AddTest1Lead.razor.cs
- Client/Pages/EditTest1Lead.razor
- Client/Pages/EditTest1Lead.razor.cs
- Client/PagesTest1Leads.razor
- Client/Pages/Test1Leads.razor.cs
- Server/Controllers/WestElmCRMTenantDB/Test1LeadsController.cs
- Server/Models/WestElmCRMTenantDB/Test1Lead.cs
Could someone help me understand why I'm unable to add a new table to my application?