Exemplo n.º 1
0
        /// <inheritdoc />
        public virtual IDbCommand GetLastInsertedID_Cmd(IDbConnection conn)
        {
            if (SourceDatabase.HasFlagFast(DbAccessType.MsSql))
            {
                return(CreateCommand("SELECT SCOPE_IDENTITY() as Value", conn));
            }

            if (SourceDatabase.HasFlagFast(DbAccessType.SqLite))
            {
                return(CreateCommand("SELECT last_insert_rowid() as Value", conn));
            }

            if (SourceDatabase.HasFlagFast(DbAccessType.MySql))
            {
                return(CreateCommand("SELECT LAST_INSERT_ID();", conn));
            }
            throw new NotImplementedException($"The GetLastInsertedId ist not implemented for the mixed type of '{SourceDatabase}' please overwrite this function to provide an query.");
        }