Files
telegram-bot/Core/Extensions/RepositoryExtension.cs
T
2022-01-22 17:13:38 +03:00

18 lines
519 B
C#

using System.Threading.Tasks;
using Kruzya.TelegramBot.Core.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Kruzya.TelegramBot.Core.Extensions
{
public static partial class RepositoryExtension
{
public static TEntity Create<TEntity>(this DbSet<TEntity> repository) where TEntity : class, new()
{
var entity = new TEntity();
repository.Add(entity);
return entity;
}
}
}