Dear Team,
I am evaluating Radzen Blazor Studio, I have a test model setup as defined below to evaluate Blazor's Studio to generate Pages in a code first Blazor Server .NET 8 application:
Here is how my model is structured:
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;namespace TestBlazorApp1.Models
{
public class Student
{[Key] public string Id { get; set; } = ""; [Index(IsUnique = false, IsClustered = true)] public DateTime EnrollmentDate { get; set; } = new DateTime(); public ClassRoom StudentClass { get; set; } = new ClassRoom(); [Index(IsUnique = false, IsClustered = true)] public string Name { get; set; } = ""; public List<Subject> Subjects { get; set; } = new List<Subject>(); } public class ClassRoom { [Key] public int ClassID { get; set; } public string ClassName { get; set; } = ""; public string BuildingName { get; set; } = ""; } public class Subject { [Key] public string SubjectName { get; set; } = ""; public string Teachedname { get; set; } = ""; public List<Student> EnrolledStudents { get; set; } = new List<Student>(); } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class IndexAttribute : Attribute { public bool IsUnique { get; set; } public bool IsClustered { get; set; } }
}
I have sqlite dbcontext setup as following:
using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TestBlazorApp1.Models;namespace TestBlazorApp1.Data
{
public partial class TestSQLiteDbContext : DbContext
{
public DbSet Students { get; set; }
public DbSet ClassRooms { get; set; }
public DbSet Subjects { get; set; }public TestSQLiteDbContext() { } public TestSQLiteDbContext(DbContextOptions<TestSQLiteDbContext> options) : base(options) { } partial void OnModelBuilding(ModelBuilder builder); protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); this.OnModelBuilding(builder); } protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) { configurationBuilder.Conventions.Add(_ => new BlankTriggerAddingConvention()); } }
}
Whenever I try to generate a CRUD Page, I get a nullReferenceException:
All of my properties in the model are not null and I have added migration/updated database and can see the tables created there so there are no syntax errors and I can save/fetch data from these entities, but it seems I cannot get a page to be created using Radzen Blazor Studio, I als created a Blazor WASM .NET app aswell but faced exactly same issue,
What could be going wrong here, Any support would be appreciated.
Regards,
Nouman