Beispiel #1
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="persistenceExecuter"></param>
 /// <param name="actionResultProcessor"></param>
 public PersistenceExecuterResultProcessorWrapper(IPersistenceExecuter persistenceExecuter, PersistenceActionResultProcessor actionResultProcessor)
 {
     persistenceExecuter.Require("persistenceExecuter").NotNull();
     actionResultProcessor.Require("actionResultProcessor").NotNull();
     _persistenceExecuter   = persistenceExecuter;
     _actionResultProcessor = actionResultProcessor;
 }
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="databaseExecuter">Executor do banco de dados.</param>
 /// <param name="cacheExecuter">Executor do cache.</param>
 /// <param name="cacheProvider"></param>
 /// <param name="typeSchema"></param>
 /// <param name="recordKeyFactory"></param>
 public DynamicPersistenceExecuter(IPersistenceExecuter databaseExecuter, IPersistenceExecuter cacheExecuter, Colosoft.Caching.ICacheProvider cacheProvider, Colosoft.Data.Schema.ITypeSchema typeSchema, Query.IRecordKeyFactory recordKeyFactory)
 {
     _databaseExecuter      = databaseExecuter;
     _cacheExecuter         = cacheExecuter;
     _cacheProvider         = cacheProvider;
     _typeSchema            = typeSchema;
     _actionResultProcessor = new Schema.PersistenceActionResultProcessor(typeSchema, recordKeyFactory);
 }
 /// <summary>
 /// Libera a instancia.
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (_cacheExecuter != null)
     {
         _cacheExecuter.Dispose();
         _cacheExecuter = null;
     }
     if (_databaseExecuter != null)
     {
         _databaseExecuter.Dispose();
         _databaseExecuter = null;
     }
 }
Beispiel #4
0
        /// <summary>
        /// Recupera a origemd de ados
        /// </summary>
        /// <param name="actions"></param>
        /// <returns></returns>
        private IPersistenceExecuter GetExecuter(PersistenceAction[] actions)
        {
            var providerName = this.ProviderLocator.GetProviderName(actions.First().EntityFullName);
            IPersistenceExecuter executer = null;

            lock (_objLock)
                if (_executers.TryGetValue(providerName, out executer))
                {
                    return(executer);
                }
            executer = _serviceLocator.GetInstance <IPersistenceExecuter>(string.Format("{0}PersistenceExecuter", providerName));
            if (executer == null)
            {
                throw new Exception(ResourceMessageFormatter.Create(() => Properties.Resources.PersistenceExecuterUndefined).Format());
            }
            lock (_objLock)
            {
                if (!_executers.ContainsKey(providerName))
                {
                    _executers.Add(providerName, executer);
                }
            }
            return(executer);
        }