/// <summary> /// Libera os dados da instancia. /// </summary> public void Dispose() { if (_selector != null) { _selector.Dispose(); _selector = null; } }
protected virtual void Initialize() { var serviceLocator = Microsoft.Practices.ServiceLocation.ServiceLocator.Current; IQueryDataSourceSelector _selector = null; try { var selectors = serviceLocator.GetAllInstances <IQueryDataSourceSelector>(); _selector = selectors.FirstOrDefault(); } catch (Exception) { } if (_selector == null) { try { _queryContext = serviceLocator.GetInstance <Colosoft.Query.ISourceContext>(); } catch (Exception ex) { throw new InvalidOperationException(Properties.Resources.Exception_FailOnLoadQueryContext, ex); } } else { _queryContext = new QuerySourceContextWrapper(new QueryDataSourceWrapper(_selector)); } try { _persistenceContext = PersistenceContextManager.PersitenceContext; } catch (Exception ex) { throw new InvalidOperationException(Properties.Resources.Exception_LoadPersistenceContextError, ex); } }
/// <summary> /// Construtor padrão. /// </summary> /// <param name="selector"></param> public QueryDataSourceWrapper(IQueryDataSourceSelector selector) { selector.Require("selector").NotNull(); _selector = selector; }