Inerska / ULApi

RESTful UL Api
GNU General Public License v3.0
1 stars 0 forks source link

Func<T?> - generic repository? #2

Open MiloszKrajewski opened 2 years ago

MiloszKrajewski commented 2 years ago

https://github.com/Inerska/ULApi/blob/993be777c64c525fec4eeb6d931858e3e41dbb44/src/ULApi.BusinessLayer/IBusinessFetcherService.cs#L23

Just on conventions:

public interface IBusinessFetcherService<TItem>
{
    TItem? Fetch();
    Task<TItem> FetchAsync();
}

So you probably should end with:

public interface IBusinessFetcherService<TItem>
{
    Task<TItem?> TryFetch();
}

But now the question is about what it does? Does it retrieve a single entity? Collection? This interface is very generic (having TItem on it and single method, it it just Func<T?>, isn't it?) while usage sounds very specific (a class to retrieve singletons?). I don't know enough what is is going to happen but generic repositories are very last lockdown ;-)