using DbCommon.BusinessCore.DbCore;
using DbCommon.Enties.DbModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbCommon.BusinessCore.BaseCore
{
    public class ApiCallFailedManager : DbContext<ApiCallFailed>
    {
        public void Init()
        {
            //If no exist create datebase 
            //Db.DbMaintenance.CreateDatabase();

            if (!Db.DbMaintenance.IsAnyTable("ApiCallFailed", false))
            {
                //Create tables
                Db.CodeFirst.InitTables(typeof(ApiCallFailed));
            }
        }

        public ApiCallFailed GetFirstOne()
        {
            return Db.Queryable<ApiCallFailed>().OrderBy(d => d.CreateTime).First();
        }
    }
}
