using System.Linq; using System.Xml.Linq; using Neo.Afx.ComponentModel; namespace Neo.Afx.Services.Integration { /// /// The integration database. /// public class IntegrationDatabase : Database { SqlIntegrationStore _sqlStore; /// /// Initializes a new instance of the class. /// public IntegrationDatabase() : base(new IntegrationContext()) { } #region Open/Close DataStore /// /// Opens the . /// public void Open() { _sqlStore = new SqlIntegrationStore(); _sqlStore.Open(); } /// /// Closes the . /// public void Close() { if(_sqlStore != null) { _sqlStore.Dispose(); _sqlStore = null; } } #endregion #region GetData /// /// Gets the data from the named data source. /// /// Invoke before the first call /// and after the last call. /// /// /// The name of the data source to be used. /// The query string to be used. /// The data from the named data source public XElement GetData(string name, string queryString) { return _sqlStore.GetData(name, queryString); } #endregion #region GetDataSource /// /// Gets the with the given ID. /// /// The data source ID to be queried. /// The with the given ID. public DataSource GetDataSource(long dataSourceID) { return GetByID(dataSourceID); } #endregion #region GetDataSources /// /// Gets a list of . /// /// A list of . public IQueryable GetDataSources() { return from q in Context.DataSources orderby q.DataSourceName where !q.IsCancelled select q; } #endregion #region GetConnectionTypes /// /// Gets a list of . /// /// A list of . public IQueryable GetConnectionTypes() { return from q in Context.ConnectionTypes orderby q.ConnectionTypeID, q.Title select q; } #endregion #region GetCommandTypes /// /// Gets a list of . /// /// A list of . public IQueryable GetCommandTypes() { return from q in Context.CommandTypes orderby q.CommandTypeID, q.Title select q; } #endregion #region GetAuthTypes /// /// Gets a list of . /// /// A list of . public IQueryable GetAuthTypes() { return from q in Context.AuthTypes orderby q.Title select q; } #endregion #region GetConnection /// /// Gets the with the given ID. /// /// The connection ID to be queried. /// The with the given ID. public Connection GetConnection(long connectionID) { return GetByID(connectionID); } #endregion #region GetConnections /// /// Gets a list of . /// /// A list of . public IQueryable GetConnections() { return from q in Context.Connections where !q.IsCancelled select q; } #endregion } }