Trying Grid Code Generator and Data Context dropdown is empty

Data Context dropdown is empty.png Hello,


I just installed the syncfusion blazor code generator  visual studio extension and am trying to generate a grid.

When I open the wizard I am able to select the Data Source, Model Class, Set Primary Key, and Columns but the Data Context is dropdown list is empty.  Why is that


1 Reply

VN Vignesh Natarajan Syncfusion Team November 23, 2021 04:39 AM UTC

Hi John, 
 
Greetings from Syncfusion support.  
 
Query: “I am able to select the Data SourceModel ClassSet Primary Key, and Columns but the Data Context is dropdown list is empty.  Why is that 
 
We have analyzed your query and we would like to inform you that Data Context dropdown will have list of DbContext inherited class that has been defined in the project application. It is used to fetch datasource from database file using Microsoft EntityFramework. If you have not defined any such classes, then that dropdown will be empty.  
 
Refer the below code example  
 
using Microsoft.EntityFrameworkCore; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Threading.Tasks; 
using DataGrid_Code.Data; 
  
namespace DataGrid_Code.Data 
{ 
    public class OrderContext : DbContext 
    { 
        public virtual DbSet<Order> Orders { getset; } 
  
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 
        { 
            if (!optionsBuilder.IsConfigured) 
            { 
                optionsBuilder.UseSqlServer(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='D:\Native support\F170426 - EF Grid\EFGrid\EFGrid\App_Data\NORTHWND.MDF';Integrated Security=True;Connect Timeout=30");                 
            } 
        } 
    } 
  
} 
 
 
If are facing this issue even after defining the DbCOntext class, kindly share the following details to validate the reported query further at our end.  
 
  1. Share your Visual Studio Version details.   
  2. Share details about your DbContext class / file.
  3.  Are you facing any compilation error / warning while opening the code generator.
  4. If possible share your model class and test project to validate the reported query at our end.
 
Above requested details will be very helpful for us to validate the reported query at our end and provide solution as early as possible.   
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon