Пример #1
0
        public static Task Create(this ISchemaObject schemaObject, NpgsqlConnection conn)
        {
            var writer = new StringWriter();

            schemaObject.WriteCreateStatement(new DdlRules(), writer);

            return(conn.CreateCommand(writer.ToString()).ExecuteNonQueryAsync());
        }
Пример #2
0
        /// <summary>
        /// Write the creation SQL for this ISchemaObject
        /// </summary>
        /// <param name="object"></param>
        /// <param name="rules"></param>
        /// <returns></returns>
        public static string ToCreateSql(this ISchemaObject @object, DdlRules rules)
        {
            var writer = new StringWriter();

            @object.WriteCreateStatement(rules, writer);

            return(writer.ToString());
        }
Пример #3
0
        protected async Task CreateSchemaObjectInDatabase(ISchemaObject schemaObject)
        {
            var rules  = new DdlRules();
            var writer = new StringWriter();

            schemaObject.WriteCreateStatement(rules, writer);

            try
            {
                await theConnection.CreateCommand(writer.ToString())
                .ExecuteNonQueryAsync();
            }
            catch (Exception e)
            {
                throw new Exception("DDL Execution Failure.\n" + writer.ToString(), e);
            }
        }