示例#1
0
        /// <summary>
        ///		Creates a New <code>DbReposetoryIdentityInsertScope</code> or obtains the current active Instance
        /// </summary>
        /// <returns></returns>
        public static DbReposetoryIdentityInsertScope CreateOrObtain(bool rewriteDefaultValues = false)
        {
            if (Current.Value != null)
            {
                return(Current.Value);
            }

            var newScope = new DbReposetoryIdentityInsertScope(rewriteDefaultValues);

            try
            {
                newScope.EnsureTransaction();
                return(newScope);
            }
            catch
            {
                newScope.Dispose();
                throw;
            }
        }
示例#2
0
 internal override void SetStore(IdentityInsertScope item)
 {
     Current = (DbReposetoryIdentityInsertScope)item;
 }