The following was done in VS2022, .net core 7.
I added a LINQ to SQL class, got the same errors but the files were created correctly. Next added netstandard-System.Data.Linq NuGet package. Then rebuild the project, added a few lines of code to validate I could read data and worked as expected.
If you are going to continue using these classes report the initial error to Microsoft using the feedback button, top right corner of Visual Studio.
Example code:
NorthdbDataContext context = new NorthdbDataContext();
var categories = context.Categories.ToList();
foreach (var category in categories)
{
Debug.WriteLine($"{category.CategoryID,-3}{category.CategoryName}");
foreach (var prod in category.Products.OrderBy(p => p.ProductName))
{
Debug.WriteLine($" {prod.ProductID,-4}{prod.ProductName}");
}
}
Diagram
Notes:
- LINQ to SQL is no longer under development
- Can have only a 1:1 mapping relationship with a database table or view.
- Use the Entity Framework Core for complex mapping