Exemplo n.º 1
0
        public static string GetInsertSql <T>(T graph, ORMappingItemCollection mapping, ISqlBuilder builder, ref List <DbParameter> dbParams, params string[] ignorProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(graph != null, "graph");
            ExceptionHelper.FalseThrow <ArgumentNullException>(mapping != null, "mapping");
            ExceptionHelper.FalseThrow <ArgumentNullException>(builder != null, "builder");

            InsertSqlClauseBuilder insertBuilder = GetInsertSqlClauseBuilder(graph, mapping, ref dbParams, ignorProperties);

            return(string.Format("INSERT INTO {0} {1}", mapping.TableName, insertBuilder.ToSqlString(builder)));
        }
Exemplo n.º 2
0
        public static InsertSqlClauseBuilder GetInsertSqlClauseBuilder <T>(T graph, ORMappingItemCollection mapping, ref List <DbParameter> dbParams, params string[] ignorProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(graph != null, "graph");
            ExceptionHelper.FalseThrow <ArgumentNullException>(mapping != null, "mapping");

            InsertSqlClauseBuilder builder = new InsertSqlClauseBuilder();

            FillSqlClauseBuilder(builder, graph, mapping, ClauseBindingFlags.Insert,
                                 new DoSqlClauseBuilderWithParams <T>(DoInsertUpdateSqlWithParamBuilder <T>), ignorProperties);

            return(builder);
        }