/// <summary>
        /// Add a data source depot into the specified data store using the specified options.
        /// </summary>
        /// <param name="dataStore">The data store to consider.</param>
        /// <param name="action">The action to execute on the created depot.</param>
        /// <returns>Returns the data store to update.</returns>
        public static IBdoDataStore RegisterDatasources(
            this IBdoDataStore dataStore,
            Action <IBdoDatasourceDepot, IBdoLog> action)
        {
            var depot = new BdoDatasourceDepot()
            {
                LazyLoadFunction = (IBdoDepot d, IBdoLog log) =>
                {
                    var number = 0;

                    if (d is BdoDatasourceDepot datasourceDepot)
                    {
                        action?.Invoke(datasourceDepot, log);

                        number = datasourceDepot.Count;

                        if (!log.HasErrorsOrExceptions())
                        {
                            log.AddMessage("Depot loaded (" + number + " data sources added)");
                        }
                    }

                    return(number);
                }
            };

            // we populate the data source depot from settings

            dataStore?.Add <IBdoDatasourceDepot>(depot);
            return(dataStore);
        }
 /// <summary>
 /// Gets the datasource depot of the specified data store.
 /// </summary>
 /// <param name="dataStore">The data store to consider.</param>
 /// <returns>Returns the datasource depot of the specified data store.</returns>
 public static IBdoDatasourceDepot GetDatasourceDepot(this IBdoDataStore dataStore)
 {
     return(dataStore?.Get <IBdoDatasourceDepot>());
 }
 /// <summary>
 /// Add a datasource depot into the specified data store executing the specified action.
 /// </summary>
 /// <param name="dataStore">The data store to consider.</param>
 /// <param name="action">The action to execute on the created depot.</param>
 /// <returns>Returns the data store to update.</returns>
 public static IBdoDataStore RegisterDatasources(
     this IBdoDataStore dataStore,
     Action <IBdoDatasourceDepot> action) =>
 RegisterDatasources(dataStore, (d, l) => action?.Invoke(d));
 /// <summary>
 /// Add a datasource depot into the specified data store executing the specified action.
 /// </summary>
 /// <param name="dataStore">The data store to consider.</param>
 /// <returns>Returns the data store to update.</returns>
 public static IBdoDataStore RegisterDatasources(
     this IBdoDataStore dataStore) =>
 RegisterDatasources(dataStore, (d, l) => { });
 /// <summary>
 /// Gets the database queries depot of the specified data store.
 /// </summary>
 /// <param name="dataStore">The data store to consider.</param>
 /// <returns>Returns the database model depot of the specified data store.</returns>
 public static IBdoDbModelDepot GetDbModelDepot(this IBdoDataStore dataStore)
 {
     return(dataStore?.Get <IBdoDbModelDepot>());
 }
 /// <summary>
 /// Add a database queries depot into the specified data store executing the specified action.
 /// </summary>
 /// <param name="dataStore">The data store to consider.</param>
 /// <param name="action">The action to execute on the created depot.</param>
 /// <returns>Returns the data store to update.</returns>
 public static IBdoDataStore RegisterDbModels(
     this IBdoDataStore dataStore,
     Action <IBdoDbModelDepot> action) =>
 RegisterDbModels(dataStore, (d, l) => action?.Invoke(d));
 /// <summary>
 /// Add a database queries depot into the specified data store executing the specified action.
 /// </summary>
 /// <param name="dataStore">The data store to consider.</param>
 /// <returns>Returns the data store to update.</returns>
 public static IBdoDataStore RegisterDbModels(
     this IBdoDataStore dataStore) =>
 RegisterDbModels(dataStore, (d, l) => { });