protected override void DoConfigure(IConfigSectionNode node) { base.DoConfigure(node); var ndata = node.NonEmpty(nameof(node))[CONFIG_DATA_SECTION] .NonEmpty($"section `{CONFIG_DATA_SECTION}`"); m_Data = FactoryUtils.MakeAndConfigureDirectedComponent <IForestDataSource>(this, ndata, typeof(ForestDataSource)); }
public static async Task <TDoc> treeExecuteAsync <TDoc>(this IForestDataSource forestData, TreePtr tree, Query <TDoc> qry) where TDoc : Doc { var doc = await forestData.GetCrudData(tree).ExecuteAsync(qry).ConfigureAwait(false); if (doc == null) { return(null); } var result = doc.CastTo <TDoc>($"Query returned value of type `{doc.GetType().DisplayNameWithExpandedGenericArgs()}`"); return(result); }
/// <summary> /// Gets ICrudDataStore context for Corporate Area /// </summary> public static ICrudDataStore GetCrudData(this IForestDataSource forestData, TreePtr tree) { var tds = forestData.NonNull(nameof(forestData)).TryGetTreeDataStore(tree.IdForest, tree.IdTree); if (tds == null) { var tnmsg = "Forest tree `{0}` is not found".Args(tree); throw new ValidationException(tnmsg) { HttpStatusCode = 404, HttpStatusDescription = tnmsg }; } return((tds as ICrudDataStore).NonNull(DATA_STORE_CLAUSE)); }
public MySqlConfForestTreeDataStore(IForestDataSource director) : base(director) { }
/// <summary> /// Extension which executes a query in tree data context and does not fetch any result /// </summary> public static ConfiguredTaskAwaitable <TDoc> TreeExecuteAsync <TDoc>(this IForestDataSource forestData, TreePtr tree, Query <TDoc> qry) where TDoc : Doc => forestData.treeExecuteAsync(tree, qry).ConfigureAwait(false);
/// <summary> /// Extension which loads a document returned by query executed in tree data context /// </summary> public static ConfiguredTaskAwaitable <TDoc> TreeLoadDocAsync <TDoc>(this IForestDataSource forestData, TreePtr tree, Query <TDoc> qry) where TDoc : Doc => forestData.GetCrudData(tree).LoadDocAsync(qry).ConfigureAwait(false);