Regarding to this topic and answer I have adapters for my async services registrations : Async provider in .NET Core DI
And it looks very fine. But I have some services, where I have properties in interface. Properties cant be async, but I need to await client object : var client = await this.connectedClient.Value;
I mean I cant use public bool Connected => (await this.connectedClient.Value).Connected;
What should I do in this case?
public interface IMyAppService
{
bool Connected{ get; }
string Host{ get; }
Task<Data> GetData();
Task SendData(Data data);
}
PS : I dont want to .Result
and .GetAwaiter().GetResult()
etc. I know Its potentially deadlock there