示例#1
0
        public void Insert <T>(IEnumerable <T> entities)
        {
            var entityList = entities.ToList();

            if (_conventionReader.HasIdentityId(typeof(T)))
            {
                var commands = CreateIdentityInsertCommands(entities);

                var ids = _dbCommandExecutor.ExecuteScalarList <int>(commands, ConnectionString);

                for (int i = 0; i < ids.Count; i++)
                {
                    _conventionReader.SetId(entityList[i], ids[i]);
                }
            }
            else
            {
                var commands = CreateInsertCommands(entities);

                _dbCommandExecutor.ExecuteNonQuery(commands, ConnectionString);
            }
        }
示例#2
0
        public IList <TScalar> FindScalarList <T, TScalar>(SqlQuery sqlQuery)
        {
            var command = CreateCommand(sqlQuery);

            return(_dbCommandExecutor.ExecuteScalarList <TScalar>(command, ConnectionString));
        }
示例#3
0
 public IList <TScalar> ExecuteScalarList <TScalar>()
 {
     return(_dbCommandExecutor.ExecuteScalarList <TScalar>(Command, ConnectionString));
 }