#if SQLCOMPACT using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Sdaleo.Systems.SQLCE { /// /// Handles SQL CE Credentials, to be /// used by all our SQL CE Functions /// public class SQLCECredential : IComparable, ICloneable, IConnectDb { #region IConnectDb /// /// Let Callers know this is a SQLCE Connection Object /// public DBSystem DBType { get { return DBSystem.SQL_CE; } } /// /// Check to see if the Credential Object consists of valid input /// public bool IsValid { get { if (!ValidationConsts.IsValidFileNameNPath(DataSource)) return false; if (!String.IsNullOrEmpty(_UDL.Password) && !ValidationConsts.Generic.IsValidPassword(_UDL.Password)) return false; return true; } } /// /// /// public string ConnectionString { get { return _UDL.ConnectionString; } } /// /// SQL CE uses the File Name and Path as the Datasource /// public string DataSource { get { return _UDL.DataSource; } } /// /// SQL CE doesn't use User /// public string User { get { return _UDL.Username; } } /// /// SQL CE doesn't support DBMS like behaviors /// public bool SupportsDBMS { get { return false; } } /// /// SQL CE doesn't support DBMS like behaviors /// public IamDBMS DBMS { get { return null; } } /// /// SQL CE doesn't support Timeouts /// public bool SupportsTimeouts { get { return false; } } /// /// SQL CE doesn't support Timeouts /// public IsupportTimeouts Timeouts { get { return null; } } #endregion private UDL _UDL = null; #region SQLCE Credential Constructors /// /// Create a SQL CE Connection from an UDL Object /// /// internal SQLCECredential(UDL udl) { if (udl != null) _UDL = udl; } /// /// Create an Untrusted SQLCE Credential * No Encryption Used * /// public SQLCECredential(string FileNameNPath) { _UDL = new UDL(FileNameNPath, String.Empty); } /// /// Create a Trusted SQLCE Credential * Encryption Used * /// public SQLCECredential(string FileNameNPath, string strPassword) { _UDL = new UDL(FileNameNPath, strPassword); } #endregion #region ICloneable Members public object Clone() { SQLCECredential credential = new SQLCECredential((UDL)this._UDL.Clone()); return credential; } #endregion #region IComparable Members public int CompareTo(object obj) { SQLCECredential otherCredential = obj as SQLCECredential; if (otherCredential != null) { int nCompare = _UDL.CompareTo(otherCredential._UDL); return nCompare; } else { throw new ArgumentException("Object is not a SQLCECredential"); } } #endregion } } #endif