// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+using System.Data;
+using System.Data.Common;
+using System.Data.Sql;
+using System.Security;
+using System.Security.Permissions;
+
namespace System.Data.SqlClient
{
- using System.Data;
- using System.Data.Common;
-
- public class SqlClientFactory : DbProviderFactory
- {
- #region Fields
- public static SqlClientFactory Instance = null;
- public static object lockStatic = new object ();
- #endregion //Fields
+ public sealed class SqlClientFactory : DbProviderFactory
+ {
+ #region Fields
+
+ public static readonly SqlClientFactory Instance = new SqlClientFactory ();
+
+ #endregion //Fields
+
+ #region Constructors
- #region Constructors
-
- private SqlClientFactory ()
- {
-
- }
+ private SqlClientFactory ()
+ {
+ }
- static SqlClientFactory ()
- {
- lock (lockStatic)
- {
- if (Instance == null)
- Instance = new SqlClientFactory ();
- }
- }
- #endregion //Constructors
+ #endregion //Constructors
- [MonoTODO]
+ #region Properties
+
public override bool CanCreateDataSourceEnumerator {
- get { throw new NotImplementedException ();}
- }
-
- #region public overrides
- public override DbCommand CreateCommand ()
- {
- return (DbCommand) new SqlCommand ();
- }
+ get { return true; }
+ }
+
+ #endregion //Properties
+
+ #region public overrides
+
+ public override DbCommand CreateCommand ()
+ {
+ return new SqlCommand ();
+ }
+
+ public override DbCommandBuilder CreateCommandBuilder ()
+ {
+ return new SqlCommandBuilder ();
+ }
+
+ public override DbConnection CreateConnection ()
+ {
+ return new SqlConnection ();
+ }
+
+ public override DbConnectionStringBuilder CreateConnectionStringBuilder ()
+ {
+ return new SqlConnectionStringBuilder ();
+ }
+
+ public override DbDataAdapter CreateDataAdapter ()
+ {
+ return new SqlDataAdapter ();
+ }
- public override DbCommandBuilder CreateCommandBuilder ()
- {
- return (DbCommandBuilder) new SqlCommandBuilder ();
- }
+ public override DbDataSourceEnumerator CreateDataSourceEnumerator ()
+ {
+ return SqlDataSourceEnumerator.Instance;
+ }
- public override DbConnection CreateConnection ()
- {
- return (DbConnection) new SqlConnection ();
- }
-
- public override DbDataAdapter CreateDataAdapter ()
- {
- return (DbDataAdapter) new SqlDataAdapter ();
- }
-
- public override DbDataSourceEnumerator CreateDataSourceEnumerator ()
- {
- return (DbDataSourceEnumerator) new SqlDataSourceEnumerator ();
- }
-
- public override DbParameter CreateParameter ()
- {
- return (DbParameter) new SqlParameter ();
- }
-
- #endregion // public overrides
- }
+ public override DbParameter CreateParameter ()
+ {
+ return new SqlParameter ();
+ }
+
+ public override CodeAccessPermission CreatePermission (PermissionState state)
+ {
+ return new SqlClientPermission(state);
+ }
+
+ #endregion // public overrides
+ }
}
-#endif // NET_2_0