I've finally started implementing Linq in our old API so I started making all the classes associated with our Tables and DB classes for the Database I followed an online guid but I can't get it working. I have the following code for my Company.cs:
using RAW_API.Models;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace RAW_API.DataContexts {
[Database]
public class Company : DataContext {
public Table<NewsItems> news_items;
public Company( string connection ) : base( connection ) { }
}
}
And for my NewsItems.cs class file:
using System;
using System.Data.Linq.Mapping;
namespace RAW_API.Models {
[Table( Name = "news_items" )]
public class NewsItems {
[Column( IsPrimaryKey = true, IsDbGenerated = true )]
public int id { get; set; }
[Column]
public string titleNL { get; set; }
[Column]
...
}
}
all classes and fields are public but it still throws the following error:
Error CS0052: Inconsistent accessibility: field type 'Table' is less accessible than field 'Company.news_items' ApplicationServerWrapper K:\Group\repo_groclaes_rawapi\ApplicationServerWrapper\DataContexts\Company.cs:8