/// <summary> /// Initializes a new instance based on another instance of <see cref="SpaDataModel"/>. /// </summary> /// <param name="model"></param> public SpaDataModel(SpaDataModel model) { PageId = model.PageId; PageKey = model.PageKey; SiteId = model.SiteId; SiteKey = model.SiteKey; ContentGuid = model.ContentGuid; ExecuteTimeMs = model.ExecuteTimeMs; IsCached = model.IsCached; Site = model.Site; Navigation = model.Navigation; Content = model.Content; Meta = new SpaResponseMeta(); }
/// <summary> /// Initializes a new instance based on the specified <paramref name="request"/>. /// </summary> /// <param name="request">An instance of <see cref="SpaRequest"/>.</param> public SpaDataModel(SpaRequest request) { PageId = request.Content?.Id ?? -1; PageKey = request.Content?.Key ?? Guid.Empty; SiteId = request.Site?.Id ?? -1; SiteKey = request.Site?.Key ?? Guid.Empty; ContentGuid = SpaEnvironment.ContentGuid; Meta = new SpaResponseMeta(); ExecuteTimeMs = -1; if (request.Arguments.Parts.Contains(SpaApiPart.Site)) { Site = request.SiteModel; } if (request.Arguments.Parts.Contains(SpaApiPart.Content)) { Content = request.ContentModel; } }