The data access layer of this service uses the DataContext (DbContext) in the Entity Framework for the underlying SQLite database for storage. Let's view the sample code here:
Note that in some services, we used the ADO.NET code, while in others, we use Entity Framework Core for the data access layers. This is done just to get a realistic feeling of some practical inconsistencies that could happen, however, but still on the SOA service interface layer, all the standards should be uniform.
public class DataContext : DbContext
{
#region Entities representing Database Objects
public DbSet<Employee> EMPLOYEE { get; set; }
public DbSet<Photo> PHOTO { get; set; }
public DbSet<Document> DOCUMENTS { get; set; }
#endregion
protected override void OnConfiguring(
DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseSqlite(@"Filename=C:SOA_Sample.db");
}
}
For SQLite in the previous code, here we are using a fixed path just for demonstration purposes, and there are no special configurations that we set for using the SQLite database.