示例#1
0
        int Execute(ISession session, InsertSqlInfo statement)
        {
            var sql        = statement.ToString(session.SessionFactory.DbSettings.SqlDialect);
            var cmdr       = new SqlCommandRunner();
            var parameters = new List <QueryParam>();

            parameters.AddRange(GeneratedKeys.Values);

            foreach (var queryParam in statement.Parameters)
            {
                if (!GeneratedKeys.ContainsKey(queryParam.Key))
                {
                    parameters.Add(queryParam.Value);
                }
            }

            return(cmdr.ExecuteNonQuery(session, sql, parameters.ToArray()));
        }
示例#2
0
        object Execute(ISession session, InsertSqlInfo statement, Type resultType)
        {
            if (resultType == null)
            {
                resultType = typeof(object);
            }

            var sql        = statement.ToString(session.SessionFactory.DbSettings.SqlDialect);
            var cmdr       = new SqlCommandRunner();
            var parameters = new List <QueryParam>();

            parameters.AddRange(GeneratedKeys.Values);

            foreach (var queryParam in statement.Parameters)
            {
                if (!GeneratedKeys.ContainsKey(queryParam.Key))
                {
                    parameters.Add(queryParam.Value);
                }
            }

            return(cmdr.ExecuteScalar(session, sql, resultType, parameters.ToArray()));
        }