You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
872 B

using EC.Service.Config;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace EC.Service.CameraInfo
{
public partial class BaseDbContext<T> : DbContext where T : class
{
public BaseDbContext()
{
}
public BaseDbContext(DbContextOptions<BaseDbContext<T>> options)
: base(options)
{
}
public virtual DbSet<T> Infos { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlite(ConfigHelper.GetDbConnection());
}
}
protected void OnModelCreatingPartial(ModelBuilder modelBuilder)
{
}
#region Select
public Task<List<T>> GetListAsync()
{
Task<List<T>> task = Task.Run(() =>
{
return new List<T>(Infos);
});
return task;
}
#endregion Select
}
}