/// <summary> /// Initializes the field for client use. /// </summary> /// <param name="api">The current api</param> public virtual void Init(IApi api) { if (Id.HasValue) { Post = api.Posts.GetById(Id.Value); if (Post == null) { // The post has been removed, remove the // missing id. Id = null; } } }
/// <summary> /// Initializes the field for client use. /// </summary> /// <param name="api">The current api</param> public virtual async Task Init(IApi api) { if (Id.HasValue) { Post = await api.Posts .GetByIdAsync(Id.Value) .ConfigureAwait(false); if (Post == null) { // The post has been removed, remove the // missing id. Id = null; } } }