Exemplo n.º 1
0
        /// <summary>
        ///     Получить последовательность генерации
        /// </summary>
        /// <returns></returns>
        public IEnumerable <SqlCommandWriter> GetWriters(DbDialect dialect, ScriptMode mode)
        {
            if (mode == ScriptMode.Create && !GenerationOptions.GenerateCreateScript)
            {
                yield break;
            }
            if (mode == ScriptMode.Drop && !GenerationOptions.GenerateDropScript)
            {
                yield break;
            }
            if (!GenerationOptions.IncludeDialect.HasFlag(dialect))
            {
                yield break;
            }
            var factory = new SqlCommandWriterFactory {
                Mode = mode, Dialect = dialect, Model = this
            };
            IEnumerable <object> objset = mode == ScriptMode.Create ? GetCreateOrderedWriters(dialect) : GetDropWriters(dialect);

            foreach (SqlCommandWriter w in factory.Get(objset))
            {
                yield return(w);
            }
        }
Exemplo n.º 2
0
		/// <summary>
		///     Получить последовательность генерации
		/// </summary>
		/// <returns></returns>
		public IEnumerable<SqlCommandWriter> GetWriters(DbDialect dialect, ScriptMode mode){
			if (mode == ScriptMode.Create && !GenerationOptions.GenerateCreateScript) yield break;
			if (mode == ScriptMode.Drop && !GenerationOptions.GenerateDropScript) yield break;
			if (!GenerationOptions.IncludeDialect.HasFlag(dialect)) yield break;
			var factory = new SqlCommandWriterFactory{Mode = mode, Dialect = dialect, Model = this};
			IEnumerable<object> objset = mode == ScriptMode.Create ? GetCreateOrderedWriters(dialect) : GetDropWriters(dialect);
			foreach (SqlCommandWriter w in factory.Get(objset)){
				yield return w;
			}
		}