Код: Выделить всё
interface ISubApi where T : IResponseModel
{
public Task FindAllAsync(int offset = 0, int limit = 1000, IDictionary @params = default);
public Task FindOneAsync(IDictionary @params = default);
public Task UpsertOneAsync(object input);
}
class OtherCustomApi : ISubApi
{
public async Task FindAllAsync(int offset = 0, int limit = 1000, IDictionary @params = null)
{
...
}
public async Task FindOneAsync(IDictionary @params = null)
{
...
}
public async Task UpsertOneAsync(object input)
{
...
}
}
class CustomApi : ISubApi
{
public async Task FindAllAsync(int offset = 0, int limit = 1000, IDictionary @params = null)
{
...
}
public async Task FindOneAsync(IDictionary @params = null)
{
...
}
public async Task UpsertOneAsync(object input)
{
...
}
}
class Manager
{
public ISubApi CustomApi { get; private set; }
public ISubApi OtherCustomApi { get; private set; }
public Manager()
{
CustomApi = new CustomApi();
OtherCustomApi = new OtherCustomApi();
}
}
Manager manager = new();
await manager.CustomApi.UpsertOneAsync(new { });
await manager.OtherCustomApi.UpsertOneAsync(new { });
Код: Выделить всё
await manager.Batch.ExecuteAsync(
manager.CustomApi.UpsertOneAsync(new { });
manager.OtherCustomApi.UpsertOneAsync(new { });
)
Это так? возможно с С#? Если нет, то как это сделать правильно?
Подробнее здесь: https://stackoverflow.com/questions/758 ... s-in-batch