List:Commits« Previous MessageNext Message »
From:Julio Casal Date:May 28 2011 2:54am
Subject:bzr commit into connector-net-6.3 branch (julio.casal:992) Bug#59168
Bug#11766128
View as plain text  
#At file:///D:/Users/jcasalt/Dev/connector-net/features/bug59168/ based on revid:reggie.burnett@stripped5034012-4c8c64fwy7g0e1j9

  992 Julio Casal	2011-05-27
      Reintroduced implementations for DbCreateDatabase, DbDatabaseExists, DbDeleteDatabase and DbCreateDatabaseScript in MySqlProviderServices. In this update none of those methods require access to the mysql database (MySQL bug #59168, Oracle bug #11766128).

    removed:
      MySql.Data.Entity/Provider/EF4ProviderServices.cs
      MySql.Data.Entity/Tests/ModelFirst.cs
    added:
      MySql.Data.Entity/Tests/ProviderServicesTests.cs
    modified:
      CHANGES
      MySql.Data.Entity/Provider/MySql.Data.Entity.csproj
      MySql.Data.Entity/Provider/ProviderServices.cs
      MySql.Data.Entity/Tests/App.Config
      MySql.Data.Entity/Tests/Model1.Designer.cs
      MySql.Data.Entity/Tests/Model1.edmx
      MySql.Data.Entity/Tests/MySql.Data.Entity.Tests.csproj
=== modified file 'CHANGES'
--- a/CHANGES	2011-05-24 01:49:52 +0000
+++ b/CHANGES	2011-05-28 02:54:22 +0000
@@ -32,6 +32,8 @@
 - Fixed MembershipProvider to only return exact matches when calling GetUser(string username) and 
   GetUserNameByEmail (MySQL bug #61027, Oracle bug #12562287).
 - added the ability to raise a join on the right side of a join to a derived table in EF code generation
+- Reintroduced implementations for DbCreateDatabase, DbDatabaseExists, DbDeleteDatabase and DbCreateDatabaseScript 
+  in MySqlProviderServices. In this update none of those methods require access to the mysql database (MySQL bug #59168, Oracle bug #11766128).
 
 Version 6.3.6
 - Fixed TracingDriver so that it normalizes long queries before truncation so we don't get exceptions     

=== removed file 'MySql.Data.Entity/Provider/EF4ProviderServices.cs'
--- a/MySql.Data.Entity/Provider/EF4ProviderServices.cs	2010-10-04 18:08:24 +0000
+++ b/MySql.Data.Entity/Provider/EF4ProviderServices.cs	1970-01-01 00:00:00 +0000
@@ -1,249 +0,0 @@
-// Copyright (c) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
-//
-// MySQL Connector/NET is licensed under the terms of the GPLv2
-// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 
-// MySQL Connectors. There are special exceptions to the terms and 
-// conditions of the GPLv2 as it is applied to this software, see the 
-// FLOSS License Exception
-// <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
-//
-// This program is free software; you can redistribute it and/or modify 
-// it under the terms of the GNU General Public License as published 
-// by the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful, but 
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along 
-// with this program; if not, write to the Free Software Foundation, Inc., 
-// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
-
-using System;
-using System.Data.Common;
-using System.Data.Common.CommandTrees;
-using System.Collections.Generic;
-using System.Data.Metadata.Edm;
-using System.Data;
-using MySql.Data.Entity;
-using System.Reflection;
-using System.Diagnostics;
-using MySql.Data.Entity.Properties;
-using System.Text;
-using System.Linq;
-
-namespace MySql.Data.MySqlClient
-{
-    internal partial class MySqlProviderServices 
-    {
-        protected override void DbCreateDatabase(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection)
-        {
-            if (connection == null)
-                throw new ArgumentNullException("connection");
-            MySqlConnection conn = connection as MySqlConnection;
-            if (conn == null)
-                throw new ArgumentException(Resources.ConnectionMustBeOfTypeMySqlConnection, "connection");
-
-            string query = DbCreateDatabaseScript(null, storeItemCollection);
-
-            using (MySqlConnection c = new MySqlConnection())
-            {
-                MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(conn.ConnectionString);
-                string dbName = sb.Database;
-                sb.Database = "mysql";
-                c.ConnectionString = sb.ConnectionString;
-                c.Open();
-
-                string fullQuery = String.Format("CREATE DATABASE `{0}`; USE `{0}`; {1}", dbName, query);
-                MySqlScript s = new MySqlScript(c, fullQuery);
-                s.Execute();
-            }
-        }
-
-        protected override bool DbDatabaseExists(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection)
-        {
-            if (connection == null)
-                throw new ArgumentNullException("connection");
-            MySqlConnection conn = connection as MySqlConnection;
-            if (conn == null)
-                throw new ArgumentException(Resources.ConnectionMustBeOfTypeMySqlConnection, "connection");
-
-            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
-            builder.ConnectionString = conn.ConnectionString;
-            string dbName = builder.Database;
-            builder.Database = "mysql";
-
-            using (MySqlConnection c = new MySqlConnection(builder.ConnectionString))
-            {
-                c.Open();
-                DataTable table = c.GetSchema("Databases", new string[] { dbName });
-                if (table != null && table.Rows.Count == 1) return true;
-                return false;
-            }
-        }
-
-        protected override void DbDeleteDatabase(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection)
-        {
-            if (connection == null)
-                throw new ArgumentNullException("connection");
-            MySqlConnection conn = connection as MySqlConnection;
-            if (conn == null)
-                throw new ArgumentException(Resources.ConnectionMustBeOfTypeMySqlConnection, "connection");
-
-            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
-            builder.ConnectionString = conn.ConnectionString;
-            string dbName = builder.Database;
-            builder.Database = "mysql";
-
-            using (MySqlConnection c = new MySqlConnection(builder.ConnectionString))
-            {
-                c.Open();
-                MySqlCommand cmd = new MySqlCommand(String.Format("DROP DATABASE IF EXISTS `{0}`", dbName), c);
-                if (commandTimeout.HasValue)
-                    cmd.CommandTimeout = commandTimeout.Value;
-                cmd.ExecuteNonQuery();
-            }
-        }
-
-        protected override string DbCreateDatabaseScript(string providerManifestToken, 
-            StoreItemCollection storeItemCollection)
-        {
-            StringBuilder sql = new StringBuilder();
-
-            sql.AppendLine("-- MySql script");
-            sql.AppendLine("-- Created on " + DateTime.Now);
-
-            foreach (EntityContainer container in storeItemCollection.GetItems<EntityContainer>())
-            {
-                // now output the tables
-                foreach (EntitySet es in container.BaseEntitySets.OfType<EntitySet>())
-                {
-                    sql.Append(GetTableCreateScript(es));
-                }
-
-                // now output the foreign keys
-                foreach (AssociationSet a in container.BaseEntitySets.OfType<AssociationSet>())
-                {
-                    sql.Append(GetAssociationCreateScript(a.ElementType));
-                }
-            }
-
-            return sql.ToString();
-        }
-
-        private string GetTableCreateScript(EntitySet entitySet)
-        {
-            EntityType e = entitySet.ElementType;
-
-            StringBuilder sql = new StringBuilder("CREATE TABLE ");
-            sql.AppendFormat("`{0}`(", e.Name);
-            string delimiter = "";
-            bool hasPK = false;
-            foreach (EdmProperty c in e.Properties)
-            {
-                Facet facet;
-                hasPK = hasPK ||
-                    (c.TypeUsage.Facets.TryGetValue("StoreGeneratedPattern", false, out facet) &&
-                    facet.Value.Equals(StoreGeneratedPattern.Identity));
-                sql.AppendFormat("{0}{1}\t`{2}` {3}{4}", delimiter, Environment.NewLine, c.Name, 
-                    GetColumnType(c.TypeUsage), GetFacetString(c));
-                delimiter = ", ";
-            }
-            sql.AppendLine(");");
-            sql.AppendLine();
-            if (!hasPK && e.KeyMembers.Count > 0)
-            {
-                sql.Append(String.Format(
-                    "ALTER TABLE `{0}` ADD PRIMARY KEY (", e.Name));
-                delimiter = "";
-                foreach (EdmMember m in e.KeyMembers)
-                {
-                    sql.AppendFormat("{0}{1}", delimiter, m.Name);
-                    delimiter = ", ";
-                }
-                sql.AppendLine(");");
-                sql.AppendLine();
-            }
-            return sql.ToString();
-        }
-
-        private string GetAssociationCreateScript(AssociationType a)
-        {
-            StringBuilder sql = new StringBuilder();
-            StringBuilder keySql = new StringBuilder();
-
-            if (a.IsForeignKey)
-            {
-                EntityType childType = (EntityType)a.ReferentialConstraints[0].ToProperties[0].DeclaringType;
-                EntityType parentType = (EntityType)a.ReferentialConstraints[0].FromProperties[0].DeclaringType;
-
-                sql.AppendLine(String.Format(
-                    "ALTER TABLE `{0}` ADD CONSTRAINT {1}", childType.Name, a.Name));
-                sql.Append("\t FOREIGN KEY (");
-                string delimiter = "";
-                foreach (EdmProperty p in a.ReferentialConstraints[0].ToProperties)
-                {
-                    EdmMember member;
-                    if (!childType.KeyMembers.TryGetValue(p.Name, false, out member))
-                        keySql.AppendLine(String.Format(
-                            "ALTER TABLE `{0}` ADD KEY (`{1}`);", childType.Name, p.Name));
-                    sql.AppendFormat("{0}{1}", delimiter, p.Name);
-                    delimiter = ", ";
-                }
-                sql.AppendLine(")");
-                delimiter = "";
-                sql.Append(String.Format("\tREFERENCES {0} (", parentType.Name));
-                foreach (EdmProperty p in a.ReferentialConstraints[0].FromProperties)
-                {
-                    EdmMember member;
-                    if (!parentType.KeyMembers.TryGetValue(p.Name, false, out member))
-                        keySql.AppendLine(String.Format(
-                            "ALTER TABLE `{0}` ADD KEY (`{1}`);", parentType.Name, p.Name));
-                    sql.AppendFormat("{0}{1}", delimiter, p.Name);
-                    delimiter = ", ";
-                }
-                sql.AppendLine(");");
-                sql.AppendLine();
-            }
-
-            keySql.Append(sql.ToString());
-            return keySql.ToString();
-        }
-
-        private string GetColumnType(TypeUsage type)
-        {
-            string t = type.EdmType.Name;
-            if (t.StartsWith("u"))
-            {
-                t = t.Substring(1).ToUpperInvariant() + " UNSIGNED";
-            }
-            else if (String.Compare(t, "guid", true) == 0)
-                return "CHAR(36) BINARY";
-            return t;
-        }
-
-        private string GetFacetString(EdmProperty column)
-        {
-            StringBuilder sql = new StringBuilder();
-            Facet facet;
-            ReadOnlyMetadataCollection<Facet> facets = column.TypeUsage.Facets;
-
-            if (column.TypeUsage.EdmType.BaseType.Name == "String")
-            {
-                if (facets.TryGetValue("MaxLength", true, out facet))
-                    sql.AppendFormat(" ({0})", facet.Value);
-            }
-            if (facets.TryGetValue("Nullable", true, out facet) && (bool)facet.Value == false)
-                sql.Append(" NOT NULL");
-            if (facets.TryGetValue("StoreGeneratedPattern", true, out facet) && facet.Value.Equals(StoreGeneratedPattern.Identity))
-                sql.Append(" AUTO_INCREMENT PRIMARY KEY");
-            return sql.ToString();
-        }
-
-        private bool IsStringType(TypeUsage type)
-        {
-            return false;
-        }
-    }
-}

=== modified file 'MySql.Data.Entity/Provider/MySql.Data.Entity.csproj'
--- a/MySql.Data.Entity/Provider/MySql.Data.Entity.csproj	2011-05-11 14:44:19 +0000
+++ b/MySql.Data.Entity/Provider/MySql.Data.Entity.csproj	2011-05-28 02:54:22 +0000
@@ -56,7 +56,7 @@ <?xml version="1.0" encoding="utf-8"?
     <DebugSymbols>true</DebugSymbols>
     <IntermediateOutputPath>obj\Debug-4.0\</IntermediateOutputPath>
     <OutputPath>bin\Debug-4.0\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DefineConstants>TRACE;DEBUG;CLR4</DefineConstants>
     <DebugType>full</DebugType>
     <PlatformTarget>AnyCPU</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
@@ -69,7 +69,7 @@ <?xml version="1.0" encoding="utf-8"?
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <IntermediateOutputPath>obj\Release-4.0\</IntermediateOutputPath>
     <OutputPath>bin\Release-4.0\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
+    <DefineConstants>TRACE;CLR4</DefineConstants>
     <Optimize>true</Optimize>
     <DebugType>pdbonly</DebugType>
     <PlatformTarget>AnyCPU</PlatformTarget>

=== modified file 'MySql.Data.Entity/Provider/ProviderServices.cs'
--- a/MySql.Data.Entity/Provider/ProviderServices.cs	2011-05-11 14:44:19 +0000
+++ b/MySql.Data.Entity/Provider/ProviderServices.cs	2011-05-28 02:54:22 +0000
@@ -31,6 +31,7 @@ using System.Reflection;
 using System.Diagnostics;
 using MySql.Data.Entity.Properties;
 using System.Text;
+using System.Linq;
 
 namespace MySql.Data.MySqlClient
 {
@@ -199,5 +200,217 @@ namespace MySql.Data.MySqlClient
         {
             return new MySqlProviderManifest(manifestToken);
         }
+
+#if CLR4
+        protected override void DbCreateDatabase(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection)
+        {
+            if (connection == null)
+                throw new ArgumentNullException("connection");
+            MySqlConnection conn = connection as MySqlConnection;
+            if (conn == null)
+                throw new ArgumentException(Resources.ConnectionMustBeOfTypeMySqlConnection, "connection");
+
+            string query = DbCreateDatabaseScript(null, storeItemCollection);
+
+            using (MySqlConnection c = new MySqlConnection())
+            {
+                MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(conn.ConnectionString);
+                string dbName = sb.Database;
+                sb.Database = null;
+                c.ConnectionString = sb.ConnectionString;
+                c.Open();
+
+                string fullQuery = String.Format("CREATE DATABASE `{0}`; USE `{0}`; {1}", dbName, query);
+                MySqlScript s = new MySqlScript(c, fullQuery);
+                s.Execute();
+            }
+        }
+
+        protected override bool DbDatabaseExists(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection)
+        {
+            if (connection == null)
+                throw new ArgumentNullException("connection");
+            MySqlConnection conn = connection as MySqlConnection;
+            if (conn == null)
+                throw new ArgumentException(Resources.ConnectionMustBeOfTypeMySqlConnection, "connection");
+
+            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
+            builder.ConnectionString = conn.ConnectionString;
+            string dbName = builder.Database;
+            builder.Database = null;
+
+            using (MySqlConnection c = new MySqlConnection(builder.ConnectionString))
+            {
+                c.Open();
+                DataTable table = c.GetSchema("Databases", new string[] { dbName });
+                if (table != null && table.Rows.Count == 1) return true;
+                return false;
+            }
+        }
+
+        protected override void DbDeleteDatabase(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection)
+        {
+            if (connection == null)
+                throw new ArgumentNullException("connection");
+            MySqlConnection conn = connection as MySqlConnection;
+            if (conn == null)
+                throw new ArgumentException(Resources.ConnectionMustBeOfTypeMySqlConnection, "connection");
+
+            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
+            builder.ConnectionString = conn.ConnectionString;
+            string dbName = builder.Database;
+            builder.Database = null;
+
+            using (MySqlConnection c = new MySqlConnection(builder.ConnectionString))
+            {
+                c.Open();
+                MySqlCommand cmd = new MySqlCommand(String.Format("DROP DATABASE IF EXISTS `{0}`", dbName), c);
+                if (commandTimeout.HasValue)
+                    cmd.CommandTimeout = commandTimeout.Value;
+                cmd.ExecuteNonQuery();
+            }
+        }
+
+        protected override string DbCreateDatabaseScript(string providerManifestToken,
+            StoreItemCollection storeItemCollection)
+        {
+            StringBuilder sql = new StringBuilder();
+
+            sql.AppendLine("-- MySql script");
+            sql.AppendLine("-- Created on " + DateTime.Now);
+
+            foreach (EntityContainer container in storeItemCollection.GetItems<EntityContainer>())
+            {
+                // now output the tables
+                foreach (EntitySet es in container.BaseEntitySets.OfType<EntitySet>())
+                {
+                    sql.Append(GetTableCreateScript(es));
+                }
+
+                // now output the foreign keys
+                foreach (AssociationSet a in container.BaseEntitySets.OfType<AssociationSet>())
+                {
+                    sql.Append(GetAssociationCreateScript(a.ElementType));
+                }
+            }
+
+            return sql.ToString();
+        }
+
+        private string GetAssociationCreateScript(AssociationType a)
+        {
+            StringBuilder sql = new StringBuilder();
+            StringBuilder keySql = new StringBuilder();
+
+            if (a.IsForeignKey)
+            {
+                EntityType childType = (EntityType)a.ReferentialConstraints[0].ToProperties[0].DeclaringType;
+                EntityType parentType = (EntityType)a.ReferentialConstraints[0].FromProperties[0].DeclaringType;
+
+                sql.AppendLine(String.Format(
+                    "ALTER TABLE `{0}` ADD CONSTRAINT {1}", childType.Name, a.Name));
+                sql.Append("\t FOREIGN KEY (");
+                string delimiter = "";
+                foreach (EdmProperty p in a.ReferentialConstraints[0].ToProperties)
+                {
+                    EdmMember member;
+                    if (!childType.KeyMembers.TryGetValue(p.Name, false, out member))
+                        keySql.AppendLine(String.Format(
+                            "ALTER TABLE `{0}` ADD KEY (`{1}`);", childType.Name, p.Name));
+                    sql.AppendFormat("{0}{1}", delimiter, p.Name);
+                    delimiter = ", ";
+                }
+                sql.AppendLine(")");
+                delimiter = "";
+                sql.Append(String.Format("\tREFERENCES {0} (", parentType.Name));
+                foreach (EdmProperty p in a.ReferentialConstraints[0].FromProperties)
+                {
+                    EdmMember member;
+                    if (!parentType.KeyMembers.TryGetValue(p.Name, false, out member))
+                        keySql.AppendLine(String.Format(
+                            "ALTER TABLE `{0}` ADD KEY (`{1}`);", parentType.Name, p.Name));
+                    sql.AppendFormat("{0}{1}", delimiter, p.Name);
+                    delimiter = ", ";
+                }
+                sql.AppendLine(");");
+                sql.AppendLine();
+            }
+
+            keySql.Append(sql.ToString());
+            return keySql.ToString();
+        }
+
+#endif
+
+        private string GetTableCreateScript(EntitySet entitySet)
+        {
+            EntityType e = entitySet.ElementType;
+
+            StringBuilder sql = new StringBuilder("CREATE TABLE ");
+            sql.AppendFormat("`{0}`(", e.Name);
+            string delimiter = "";
+            bool hasPK = false;
+            foreach (EdmProperty c in e.Properties)
+            {
+                Facet facet;
+                hasPK = hasPK ||
+                    (c.TypeUsage.Facets.TryGetValue("StoreGeneratedPattern", false, out facet) &&
+                    facet.Value.Equals(StoreGeneratedPattern.Identity));
+                sql.AppendFormat("{0}{1}\t`{2}` {3}{4}", delimiter, Environment.NewLine, c.Name,
+                    GetColumnType(c.TypeUsage), GetFacetString(c));
+                delimiter = ", ";
+            }
+            sql.AppendLine(");");
+            sql.AppendLine();
+            if (!hasPK && e.KeyMembers.Count > 0)
+            {
+                sql.Append(String.Format(
+                    "ALTER TABLE `{0}` ADD PRIMARY KEY (", e.Name));
+                delimiter = "";
+                foreach (EdmMember m in e.KeyMembers)
+                {
+                    sql.AppendFormat("{0}{1}", delimiter, m.Name);
+                    delimiter = ", ";
+                }
+                sql.AppendLine(");");
+                sql.AppendLine();
+            }
+            return sql.ToString();
+        }
+
+        private string GetColumnType(TypeUsage type)
+        {
+            string t = type.EdmType.Name;
+            if (t.StartsWith("u"))
+            {
+                t = t.Substring(1).ToUpperInvariant() + " UNSIGNED";
+            }
+            else if (String.Compare(t, "guid", true) == 0)
+                return "CHAR(36) BINARY";
+            return t;
+        }
+
+        private string GetFacetString(EdmProperty column)
+        {
+            StringBuilder sql = new StringBuilder();
+            Facet facet;
+            ReadOnlyMetadataCollection<Facet> facets = column.TypeUsage.Facets;
+
+            if (column.TypeUsage.EdmType.BaseType.Name == "String")
+            {
+                if (facets.TryGetValue("MaxLength", true, out facet))
+                    sql.AppendFormat(" ({0})", facet.Value);
+            }
+            if (facets.TryGetValue("Nullable", true, out facet) && (bool)facet.Value == false)
+                sql.Append(" NOT NULL");
+            if (facets.TryGetValue("StoreGeneratedPattern", true, out facet) && facet.Value.Equals(StoreGeneratedPattern.Identity))
+                sql.Append(" AUTO_INCREMENT PRIMARY KEY");
+            return sql.ToString();
+        }
+
+        private bool IsStringType(TypeUsage type)
+        {
+            return false;
+        }
     }
 }

=== modified file 'MySql.Data.Entity/Tests/App.Config'
--- a/MySql.Data.Entity/Tests/App.Config	2010-10-04 18:08:24 +0000
+++ b/MySql.Data.Entity/Tests/App.Config	2011-05-28 02:54:22 +0000
@@ -9,6 +9,6 @@ <?xml version="1.0" encoding="utf-8"?
 
   <connectionStrings>
     <add name="testEntities" connectionString="metadata=res://*/TestModel.csdl|res://*/TestModel.ssdl|res://*/TestModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;Data Source=localhost;database=test;uid=root;pooling=false&quot;" providerName="System.Data.EntityClient" />
-    <add name="Model1Container" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;Data Source=localhost;database=modeldb;uid=root;pooling=false&quot;" providerName="System.Data.EntityClient" />
+    <add name="Model1Container" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;Data Source=localhost;database=modeldb;uid=test;password=test;pooling=false&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
 </configuration>
\ No newline at end of file

=== modified file 'MySql.Data.Entity/Tests/Model1.Designer.cs'
--- a/MySql.Data.Entity/Tests/Model1.Designer.cs	2010-10-04 18:08:24 +0000
+++ b/MySql.Data.Entity/Tests/Model1.Designer.cs	2011-05-28 02:54:22 +0000
@@ -1,146 +1,113 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
-//    This code was generated from a template.
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.5444
 //
-//    Manual changes to this file may cause unexpected behavior in your application.
-//    Manual changes to this file will be overwritten if the code is regenerated.
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-using System;
-using System.Data.Objects;
-using System.Data.Objects.DataClasses;
-using System.Data.EntityClient;
-using System.ComponentModel;
-using System.Xml.Serialization;
-using System.Runtime.Serialization;
-
-[assembly: EdmSchemaAttribute()]
+[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
 
+// Original file name:
+// Generation date: 5/27/2011 6:15:37 PM
 namespace MySql.Data.Entity.Tests
 {
-    #region Contexts
     
     /// <summary>
-    /// No Metadata Documentation available.
+    /// There are no comments for Model1Container in the schema.
     /// </summary>
-    public partial class Model1Container : ObjectContext
+    public partial class Model1Container : global::System.Data.Objects.ObjectContext
     {
-        #region Constructors
-    
         /// <summary>
         /// Initializes a new Model1Container object using the connection string found in the 'Model1Container' section of the application configuration file.
         /// </summary>
-        public Model1Container() : base("name=Model1Container", "Model1Container")
+        public Model1Container() : 
+                base("name=Model1Container", "Model1Container")
         {
-            this.ContextOptions.LazyLoadingEnabled = true;
-            OnContextCreated();
+            this.OnContextCreated();
         }
-    
         /// <summary>
         /// Initialize a new Model1Container object.
         /// </summary>
-        public Model1Container(string connectionString) : base(connectionString, "Model1Container")
+        public Model1Container(string connectionString) : 
+                base(connectionString, "Model1Container")
         {
-            this.ContextOptions.LazyLoadingEnabled = true;
-            OnContextCreated();
+            this.OnContextCreated();
         }
-    
         /// <summary>
         /// Initialize a new Model1Container object.
         /// </summary>
-        public Model1Container(EntityConnection connection) : base(connection, "Model1Container")
+        public Model1Container(global::System.Data.EntityClient.EntityConnection connection) : 
+                base(connection, "Model1Container")
         {
-            this.ContextOptions.LazyLoadingEnabled = true;
-            OnContextCreated();
+            this.OnContextCreated();
         }
-    
-        #endregion
-    
-        #region Partial Methods
-    
         partial void OnContextCreated();
-    
-        #endregion
-    
-        #region ObjectSet Properties
-    
         /// <summary>
-        /// No Metadata Documentation available.
+        /// There are no comments for Animals in the schema.
         /// </summary>
-        public ObjectSet<Animal> Animals
+        public global::System.Data.Objects.ObjectQuery<Animal> Animals
         {
             get
             {
-                if ((_Animals == null))
+                if ((this._Animals == null))
                 {
-                    _Animals = base.CreateObjectSet<Animal>("Animals");
+                    this._Animals = base.CreateQuery<Animal>("[Animals]");
                 }
-                return _Animals;
+                return this._Animals;
             }
         }
-        private ObjectSet<Animal> _Animals;
-    
+        private global::System.Data.Objects.ObjectQuery<Animal> _Animals;
         /// <summary>
-        /// No Metadata Documentation available.
+        /// There are no comments for Shelters in the schema.
         /// </summary>
-        public ObjectSet<Shelter> Shelters
+        public global::System.Data.Objects.ObjectQuery<Shelter> Shelters
         {
             get
             {
-                if ((_Shelters == null))
+                if ((this._Shelters == null))
                 {
-                    _Shelters = base.CreateObjectSet<Shelter>("Shelters");
+                    this._Shelters = base.CreateQuery<Shelter>("[Shelters]");
                 }
-                return _Shelters;
+                return this._Shelters;
             }
         }
-        private ObjectSet<Shelter> _Shelters;
-
-        #endregion
-        #region AddTo Methods
-    
+        private global::System.Data.Objects.ObjectQuery<Shelter> _Shelters;
         /// <summary>
-        /// Deprecated Method for adding a new object to the Animals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
+        /// There are no comments for Animals in the schema.
         /// </summary>
         public void AddToAnimals(Animal animal)
         {
             base.AddObject("Animals", animal);
         }
-    
         /// <summary>
-        /// Deprecated Method for adding a new object to the Shelters EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
+        /// There are no comments for Shelters in the schema.
         /// </summary>
         public void AddToShelters(Shelter shelter)
         {
             base.AddObject("Shelters", shelter);
         }
-
-        #endregion
     }
-    
-
-    #endregion
-    
-    #region Entities
-    
     /// <summary>
-    /// No Metadata Documentation available.
+    /// There are no comments for Model1.Animal in the schema.
     /// </summary>
-    [EdmEntityTypeAttribute(NamespaceName="Model1", Name="Animal")]
-    [Serializable()]
-    [DataContractAttribute(IsReference=true)]
-    public partial class Animal : EntityObject
+    /// <KeyProperties>
+    /// Id
+    /// </KeyProperties>
+    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="Model1", Name="Animal")]
+    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
+    [global::System.Serializable()]
+    public partial class Animal : global::System.Data.Objects.DataClasses.EntityObject
     {
-        #region Factory Method
-    
         /// <summary>
         /// Create a new Animal object.
         /// </summary>
-        /// <param name="id">Initial value of the Id property.</param>
-        /// <param name="name">Initial value of the Name property.</param>
-        /// <param name="shelterId">Initial value of the ShelterId property.</param>
-        public static Animal CreateAnimal(global::System.Int32 id, global::System.String name, global::System.Int32 shelterId)
+        /// <param name="id">Initial value of Id.</param>
+        /// <param name="name">Initial value of Name.</param>
+        /// <param name="shelterId">Initial value of ShelterId.</param>
+        public static Animal CreateAnimal(int id, string name, int shelterId)
         {
             Animal animal = new Animal();
             animal.Id = id;
@@ -148,144 +115,119 @@ namespace MySql.Data.Entity.Tests
             animal.ShelterId = shelterId;
             return animal;
         }
-
-        #endregion
-        #region Primitive Properties
-    
         /// <summary>
-        /// No Metadata Documentation available.
+        /// There are no comments for Property Id in the schema.
         /// </summary>
-        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
-        [DataMemberAttribute()]
-        public global::System.Int32 Id
+        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
+        [global::System.Runtime.Serialization.DataMemberAttribute()]
+        public int Id
         {
             get
             {
-                return _Id;
+                return this._Id;
             }
             set
             {
-                if (_Id != value)
-                {
-                    OnIdChanging(value);
-                    ReportPropertyChanging("Id");
-                    _Id = StructuralObject.SetValidValue(value);
-                    ReportPropertyChanged("Id");
-                    OnIdChanged();
-                }
+                this.OnIdChanging(value);
+                this.ReportPropertyChanging("Id");
+                this._Id = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+                this.ReportPropertyChanged("Id");
+                this.OnIdChanged();
             }
         }
-        private global::System.Int32 _Id;
-        partial void OnIdChanging(global::System.Int32 value);
+        private int _Id;
+        partial void OnIdChanging(int value);
         partial void OnIdChanged();
-    
         /// <summary>
-        /// No Metadata Documentation available.
+        /// There are no comments for Property Name in the schema.
         /// </summary>
-        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
-        [DataMemberAttribute()]
-        public global::System.String Name
+        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
+        [global::System.Runtime.Serialization.DataMemberAttribute()]
+        public string Name
         {
             get
             {
-                return _Name;
+                return this._Name;
             }
             set
             {
-                OnNameChanging(value);
-                ReportPropertyChanging("Name");
-                _Name = StructuralObject.SetValidValue(value, false);
-                ReportPropertyChanged("Name");
-                OnNameChanged();
+                this.OnNameChanging(value);
+                this.ReportPropertyChanging("Name");
+                this._Name = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
+                this.ReportPropertyChanged("Name");
+                this.OnNameChanged();
             }
         }
-        private global::System.String _Name;
-        partial void OnNameChanging(global::System.String value);
+        private string _Name;
+        partial void OnNameChanging(string value);
         partial void OnNameChanged();
-    
         /// <summary>
-        /// No Metadata Documentation available.
+        /// There are no comments for Property ShelterId in the schema.
         /// </summary>
-        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
-        [DataMemberAttribute()]
-        public global::System.Int32 ShelterId
+        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
+        [global::System.Runtime.Serialization.DataMemberAttribute()]
+        public int ShelterId
         {
             get
             {
-                return _ShelterId;
+                return this._ShelterId;
             }
             set
             {
-                OnShelterIdChanging(value);
-                ReportPropertyChanging("ShelterId");
-                _ShelterId = StructuralObject.SetValidValue(value);
-                ReportPropertyChanged("ShelterId");
-                OnShelterIdChanged();
+                this.OnShelterIdChanging(value);
+                this.ReportPropertyChanging("ShelterId");
+                this._ShelterId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+                this.ReportPropertyChanged("ShelterId");
+                this.OnShelterIdChanged();
             }
         }
-        private global::System.Int32 _ShelterId;
-        partial void OnShelterIdChanging(global::System.Int32 value);
+        private int _ShelterId;
+        partial void OnShelterIdChanging(int value);
         partial void OnShelterIdChanged();
-
-        #endregion
-    
     }
-    
     /// <summary>
-    /// No Metadata Documentation available.
+    /// There are no comments for Model1.Shelter in the schema.
     /// </summary>
-    [EdmEntityTypeAttribute(NamespaceName="Model1", Name="Shelter")]
-    [Serializable()]
-    [DataContractAttribute(IsReference=true)]
-    public partial class Shelter : EntityObject
+    /// <KeyProperties>
+    /// Id
+    /// </KeyProperties>
+    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="Model1", Name="Shelter")]
+    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
+    [global::System.Serializable()]
+    public partial class Shelter : global::System.Data.Objects.DataClasses.EntityObject
     {
-        #region Factory Method
-    
         /// <summary>
         /// Create a new Shelter object.
         /// </summary>
-        /// <param name="id">Initial value of the Id property.</param>
-        public static Shelter CreateShelter(global::System.Int32 id)
+        /// <param name="id">Initial value of Id.</param>
+        public static Shelter CreateShelter(int id)
         {
             Shelter shelter = new Shelter();
             shelter.Id = id;
             return shelter;
         }
-
-        #endregion
-        #region Primitive Properties
-    
         /// <summary>
-        /// No Metadata Documentation available.
+        /// There are no comments for Property Id in the schema.
         /// </summary>
-        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
-        [DataMemberAttribute()]
-        public global::System.Int32 Id
+        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
+        [global::System.Runtime.Serialization.DataMemberAttribute()]
+        public int Id
         {
             get
             {
-                return _Id;
+                return this._Id;
             }
             set
             {
-                if (_Id != value)
-                {
-                    OnIdChanging(value);
-                    ReportPropertyChanging("Id");
-                    _Id = StructuralObject.SetValidValue(value);
-                    ReportPropertyChanged("Id");
-                    OnIdChanged();
-                }
+                this.OnIdChanging(value);
+                this.ReportPropertyChanging("Id");
+                this._Id = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+                this.ReportPropertyChanged("Id");
+                this.OnIdChanged();
             }
         }
-        private global::System.Int32 _Id;
-        partial void OnIdChanging(global::System.Int32 value);
+        private int _Id;
+        partial void OnIdChanging(int value);
         partial void OnIdChanged();
-
-        #endregion
-    
     }
-
-    #endregion
-    
 }

=== modified file 'MySql.Data.Entity/Tests/Model1.edmx'
--- a/MySql.Data.Entity/Tests/Model1.edmx	2010-10-04 18:08:24 +0000
+++ b/MySql.Data.Entity/Tests/Model1.edmx	2011-05-28 02:54:22 +0000
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
-<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
+<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
   <!-- EF Runtime content -->
   <edmx:Runtime>
     <!-- SSDL content -->
     <edmx:StorageModels>
-      <Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" Namespace="Model1.Store" Alias="Self" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5">
+      <Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl" Namespace="Model1.Store" Alias="Self" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5">
         <EntityContainer Name="Model1TargetContainer" >
-          <EntitySet Name="Animals" EntityType="Model1.Store.TheAnimals" Schema="modeldb" />
-          <EntitySet Name="Facilities" EntityType="Model1.Store.Facility" Schema="modeldb" />
+          <EntitySet Name="Animals" EntityType="Model1.Store.TheAnimals" />
+          <EntitySet Name="Facilities" EntityType="Model1.Store.Facility" />
         </EntityContainer>
         <EntityType Name="TheAnimals">
           <Key>
@@ -27,8 +27,8 @@ <?xml version="1.0" encoding="utf-8"?
     </edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
-      <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="Model1" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
-        <EntityContainer Name="Model1Container" annotation:LazyLoadingEnabled="true">
+      <Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="Model1" Alias="Self">
+        <EntityContainer Name="Model1Container" >
           <EntitySet Name="Animals" EntityType="Model1.Animal" />
           <EntitySet Name="Shelters" EntityType="Model1.Shelter" />
         </EntityContainer>
@@ -36,7 +36,7 @@ <?xml version="1.0" encoding="utf-8"?
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Type="Int32" Name="Id" Nullable="false" />
           <Property Type="String" Name="Name" Nullable="false" />
           <Property Type="Int32" Name="ShelterId" Nullable="false" />
         </EntityType>
@@ -44,13 +44,13 @@ <?xml version="1.0" encoding="utf-8"?
           <Key>
             <PropertyRef Name="Id" />
           </Key>
-          <Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Type="Int32" Name="Id" Nullable="false" />
         </EntityType>
       </Schema>
     </edmx:ConceptualModels>
     <!-- C-S mapping content -->
     <edmx:Mappings>
-      <Mapping xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs" Space="C-S">
+      <Mapping xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS" Space="C-S">
         <Alias Key="Model" Value="Model1" />
         <Alias Key="Target" Value="Model1.Store" />
         <EntityContainerMapping CdmEntityContainer="Model1Container" StorageEntityContainer="Model1TargetContainer">
@@ -67,7 +67,7 @@ <?xml version="1.0" encoding="utf-8"?
     </edmx:Mappings>
   </edmx:Runtime>
   <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
-  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx">
     <edmx:Connection>
       <DesignerInfoPropertySet>
         <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />

=== removed file 'MySql.Data.Entity/Tests/ModelFirst.cs'
--- a/MySql.Data.Entity/Tests/ModelFirst.cs	2010-10-04 18:08:24 +0000
+++ b/MySql.Data.Entity/Tests/ModelFirst.cs	1970-01-01 00:00:00 +0000
@@ -1,84 +0,0 @@
-// Copyright (c) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
-//
-// MySQL Connector/NET is licensed under the terms of the GPLv2
-// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 
-// MySQL Connectors. There are special exceptions to the terms and 
-// conditions of the GPLv2 as it is applied to this software, see the 
-// FLOSS License Exception
-// <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
-//
-// This program is free software; you can redistribute it and/or modify 
-// it under the terms of the GNU General Public License as published 
-// by the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful, but 
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along 
-// with this program; if not, write to the Free Software Foundation, Inc., 
-// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
-
-using System;
-using System.Data;
-using System.Threading;
-using MySql.Data.MySqlClient;
-using MySql.Data.MySqlClient.Tests;
-using System.Data.EntityClient;
-using System.Data.Common;
-using NUnit.Framework;
-using System.Data.Objects;
-
-namespace MySql.Data.Entity.Tests
-{
-	[TestFixture]
-	public class ModelFirst : BaseEdmTest
-	{
-        [Test]
-        public void CreateDatabase()
-        {
-            using (Model1Container ctx = new Model1Container())
-            {
-                Assert.IsFalse(ctx.DatabaseExists());
-                ctx.CreateDatabase();
-                Assert.IsTrue(ctx.DatabaseExists());
-            }
-        }
-
-        [Test]
-        public void CreateDatabaseScript()
-        {
-            using (testEntities ctx = new testEntities())
-            {
-                string s = ctx.CreateDatabaseScript();
-            }
-        }
-
-        [Test]
-        public void DeleteDatabase()
-        {
-            using (Model1Container ctx = new Model1Container())
-            {
-                Assert.IsFalse(ctx.DatabaseExists());
-                ctx.CreateDatabase();
-                Assert.IsTrue(ctx.DatabaseExists());
-                ctx.DeleteDatabase();
-                Assert.IsFalse(ctx.DatabaseExists());
-            }
-        }
-
-        [Test]
-        public void DatabaseExists()
-        {
-            using (Model1Container ctx = new Model1Container())
-            {
-                Assert.IsFalse(ctx.DatabaseExists());
-                ctx.CreateDatabase();
-                Assert.IsTrue(ctx.DatabaseExists());
-                ctx.DeleteDatabase();
-                Assert.IsFalse(ctx.DatabaseExists());
-            }
-        }
-    }
-}
\ No newline at end of file

=== modified file 'MySql.Data.Entity/Tests/MySql.Data.Entity.Tests.csproj'
--- a/MySql.Data.Entity/Tests/MySql.Data.Entity.Tests.csproj	2011-05-18 20:55:46 +0000
+++ b/MySql.Data.Entity/Tests/MySql.Data.Entity.Tests.csproj	2011-05-28 02:54:22 +0000
@@ -109,6 +109,12 @@ <?xml version="1.0" encoding="utf-8"?
     <Compile Include="AggregateOperators.cs" />
     <Compile Include="CanonicalFunctions.cs" />
     <Compile Include="DataTypeTests.cs" />
+    <Compile Include="Model1.Designer.cs" >
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Model1.edmx</DependentUpon>
+    </Compile>
+    <Compile Include="ProviderServicesTests.cs" />
     <Compile Include="ProceduresAndFunctions.cs" />
     <Compile Include="JoinTests.cs" />
     <Compile Include="SchemaInformation.cs" />
@@ -158,6 +164,10 @@ <?xml version="1.0" encoding="utf-8"?
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>SQLSyntax.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EntityDeploy Include="Model1.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>Model1.Designer.cs</LastGenOutput>
+    </EntityDeploy>
   </ItemGroup>
   <ItemGroup>
     <WCFMetadata Include="Service References" />

=== added file 'MySql.Data.Entity/Tests/ProviderServicesTests.cs'
--- a/MySql.Data.Entity/Tests/ProviderServicesTests.cs	1970-01-01 00:00:00 +0000
+++ b/MySql.Data.Entity/Tests/ProviderServicesTests.cs	2011-05-28 02:54:22 +0000
@@ -0,0 +1,95 @@
+// Copyright (c) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+//
+// MySQL Connector/NET is licensed under the terms of the GPLv2
+// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 
+// MySQL Connectors. There are special exceptions to the terms and 
+// conditions of the GPLv2 as it is applied to this software, see the 
+// FLOSS License Exception
+// <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
+//
+// This program is free software; you can redistribute it and/or modify 
+// it under the terms of the GNU General Public License as published 
+// by the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful, but 
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along 
+// with this program; if not, write to the Free Software Foundation, Inc., 
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+
+using System;
+using System.Data;
+using System.Threading;
+using MySql.Data.MySqlClient;
+using MySql.Data.MySqlClient.Tests;
+using System.Data.EntityClient;
+using System.Data.Common;
+using NUnit.Framework;
+using System.Data.Objects;
+
+namespace MySql.Data.Entity.Tests
+{
+	[TestFixture]
+    public class ProviderServicesTests : BaseEdmTest
+	{
+        #if CLR4
+        [Test]
+        public void CreateDatabase()
+        {
+            suExecSQL("GRANT ALL ON `modeldb`.* to 'test'@'localhost'");
+            suExecSQL("FLUSH PRIVILEGES");
+
+            using (Model1Container ctx = new Model1Container())
+            {
+                Assert.IsFalse(ctx.DatabaseExists());
+                ctx.CreateDatabase();
+                Assert.IsTrue(ctx.DatabaseExists());
+            }
+        }
+
+        [Test]
+        public void CreateDatabaseScript()
+        {
+            using (testEntities ctx = new testEntities())
+            {
+                string s = ctx.CreateDatabaseScript();
+            }
+        }
+
+        [Test]
+        public void DeleteDatabase()
+        {
+            suExecSQL("GRANT ALL ON `modeldb`.* to 'test'@'localhost'");
+            suExecSQL("FLUSH PRIVILEGES");
+
+            using (Model1Container ctx = new Model1Container())
+            {
+                Assert.IsFalse(ctx.DatabaseExists());
+                ctx.CreateDatabase();
+                Assert.IsTrue(ctx.DatabaseExists());
+                ctx.DeleteDatabase();
+                Assert.IsFalse(ctx.DatabaseExists());
+            }
+        }
+
+        [Test]
+        public void DatabaseExists()
+        {
+            suExecSQL("GRANT ALL ON `modeldb`.* to 'test'@'localhost'");
+            suExecSQL("FLUSH PRIVILEGES");
+
+            using (Model1Container ctx = new Model1Container())
+            {
+                Assert.IsFalse(ctx.DatabaseExists());
+                ctx.CreateDatabase();
+                Assert.IsTrue(ctx.DatabaseExists());
+                ctx.DeleteDatabase();
+                Assert.IsFalse(ctx.DatabaseExists());
+            }
+        }
+#endif
+    }
+}
\ No newline at end of file

Attachment: [text/bzr-bundle] bzr/julio.casal@oracle.com-20110528025422-xz48yymg8oevr2ew.bundle
Thread
bzr commit into connector-net-6.3 branch (julio.casal:992) Bug#59168Bug#11766128Julio Casal31 May