WeihanLi/WeihanLi.Common

Add more method to IRepository

Closed this issue · 5 comments

Add the following methods to IRepository interface:
int Update(TEntity entity, params Expression<Func<TEntity, object>>[] propertyExpressions);
int Update(TEntity entity, params string[] propertyNames);
Task UpdateAsync(TEntity entity, Expression<Func<TEntity, object>>[] propertyExpressions, CancellationToken cancellationToken = default);
Task UpdateAsync(TEntity entity, string[] propertyNames, CancellationToken cancellationToken = default);

Purpose:
Make application service layer depend the IRepository instead of the IEFRepository layer so it decouples the domain service and the infrusture.

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.99. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

we should know that which is the primary key to specific the where condition,
we could treat the property with KeyAttribute or Id property as primary key for now, but maybe another great way to config these mappings

what about Delete(TEntity entity)?

what about Delete(TEntity entity)?

Yes, Delete(TEntity entity) and KeyAttribute or Id property is enough.