Exemplo n.º 1
0
        public async Task <T> GetModel <T>(Guid id) where T : class, IDataModel
        {
            using var ctx = new EntityFrameworkDataTools(_configuration.ReadWriteConnectionString);
            var rtn = await ctx.FindAsync <T>(id);

            return(rtn);
        }
Exemplo n.º 2
0
        public async Task RemoveModel <T>(Guid id) where T : class, IDataModel
        {
            using var ctx = new EntityFrameworkDataTools(_configuration.ReadWriteConnectionString);
            var model = await ctx.FindAsync <T>(id);

            ctx.Remove(model);
            await ctx.SaveChangesAsync();
        }