Example #1
0
        /// <summary>
        /// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
        /// embedded resource in the current assembly.
        /// </summary>
        /// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
        /// in the current assembly.</param>
        /// <param name="connectionString">The connection string to use. This parameter can be set to null or <see cref="String.Empty" />
        /// when calling this function from an initialized data provider, since in that case it will use the connection string passed to the
        /// data provider.</param>
        internal static void ExecuteSqlUpgradeScript(GalleryDataSchemaUpgradeScript script, string connectionString)
        {
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            string scriptLocation          = String.Format(CultureInfo.InvariantCulture, "GalleryServerPro.Data.SqlCe.{0}.sqlce", script);

            using (Stream stream = asm.GetManifestResourceStream(scriptLocation))
            {
                if (stream == null)
                {
                    throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Unable to find embedded resource file named {0}", scriptLocation));
                }

                ExecuteSqlInStream(stream, connectionString);
            }
        }
Example #2
0
        /// <summary>
        /// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
        /// embedded resource in the current assembly.
        /// </summary>
        /// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
        /// in the current assembly.</param>
        private static void ExecuteSqlUpgrade(GalleryDataSchemaUpgradeScript script)
        {
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            string scriptLocation          = String.Format("GalleryServerPro.Data.SqlServer.{0}.sql", script);

            using (System.IO.Stream stream = asm.GetManifestResourceStream(scriptLocation))
            {
                if (stream == null)
                {
                    throw new ArgumentException(String.Format("Unable to find embedded resource file named {0}", scriptLocation));
                }

                ExecuteSqlInStream(stream);
            }
        }
Example #3
0
        /// <summary>
        /// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
        /// embedded resource in the current assembly.
        /// </summary>
        /// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
        /// in the current assembly.</param>
        /// <param name="connectionString">The connection string to use. This parameter can be set to null or <see cref="String.Empty" />
        /// when calling this function from an initialized data provider, since in that case it will use the connection string passed to the 
        /// data provider.</param>
        internal static void ExecuteSqlUpgradeScript(GalleryDataSchemaUpgradeScript script, string connectionString)
        {
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            string scriptLocation = String.Format(CultureInfo.InvariantCulture, "GalleryServerPro.Data.SqlCe.{0}.sql", script);
            using (Stream stream = asm.GetManifestResourceStream(scriptLocation))
            {
                if (stream == null)
                    throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Unable to find embedded resource file named {0}", scriptLocation));

                ExecuteSqlInStream(stream, connectionString);
            }
        }
Example #4
0
 /// <summary>
 /// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
 /// embedded resource in the current assembly.
 /// </summary>
 /// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
 /// in the current assembly.</param>
 internal static void ExecuteSqlUpgradeScript(GalleryDataSchemaUpgradeScript script)
 {
     ExecuteSqlUpgradeScript(script, null);
 }
Example #5
0
 /// <summary>
 /// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
 /// embedded resource in the current assembly.
 /// </summary>
 /// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
 /// in the current assembly.</param>
 internal static void ExecuteSqlUpgradeScript(GalleryDataSchemaUpgradeScript script)
 {
     ExecuteSqlUpgradeScript(script, null);
 }
Example #6
0
		/// <summary>
		/// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
		/// embedded resource in the current assembly.
		/// </summary>
		/// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
		/// in the current assembly.</param>
		private static void ExecuteSqlUpgrade(GalleryDataSchemaUpgradeScript script)
		{
			System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
			string scriptLocation = String.Format("GalleryServerPro.Data.SqlServer.{0}.sql", script);
			using (System.IO.Stream stream = asm.GetManifestResourceStream(scriptLocation))
			{
				if (stream == null)
					throw new ArgumentException(String.Format("Unable to find embedded resource file named {0}", scriptLocation));

				ExecuteSqlInStream(stream);
			}
		}
		/// <summary>
		/// Executes the SQL script represented by the specified <paramref name="script"/>. The actual SQL file is stored as an
		/// embedded resource in the current assembly.
		/// </summary>
		/// <param name="script">The script to execute. This value is used to lookup the SQL file stored as an embedded resource
		/// in the current assembly.</param>
		private static void ExecuteSqlUpgrade(GalleryDataSchemaUpgradeScript script)
		{
			System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
			using (System.IO.Stream stream = asm.GetManifestResourceStream(String.Format("GalleryServerPro.Data.SQLite.{0}.sql", script)))
			{
				ExecuteSqlInStream(stream);
			}
		}