예제 #1
0
        /// <summary>
        /// Inserts an entity.
        /// </summary>
        /// <param name="entity">The entity to insert.</param>
        /// <returns>The numer of items affected.</returns>
        public int Insert(T entity)
        {
            _Mutex.WaitOne();
            try
            {
                object identityValue;

                int identityOrdinal = _Aspect.IdentityOrdinal;
                int result          = _Engine.Insert(_Aspect, EnumerateValuesExcludingMember(_Aspect, entity, DataScope.Insert, identityOrdinal), out identityValue);

                if (identityOrdinal >= 0)
                {
                    _Aspect[identityOrdinal].SetValue(entity, identityValue);
                }

                return(result);
            }
            finally
            {
                _Mutex.ReleaseMutex();
            }
        }
예제 #2
0
        /// <summary>
        /// Executes the insert.
        /// </summary>
        /// <returns>The number of items affected.</returns>
        public int Insert()
        {
            object identityValue;

            return(_Storage.Insert(_Aspect, _Values, out identityValue));
        }