Example #1
0
        /// <summary>
        /// Maps a <see cref="System.Transactions.IsolationLevel"/> to <see cref="IsolationLevel"/>
        /// </summary>
        /// <param name="isolationLevel">The isolation level to map.</param>
        /// <returns>A corresponding <see cref="IsolationLevel"/></returns>
        private static IsolationLevel MapToSystemDataIsolationLevel(System.Transactions.IsolationLevel isolationLevel)
        {
            switch (isolationLevel)
            {
            case System.Transactions.IsolationLevel.Chaos:
                return(IsolationLevel.Chaos);

            case System.Transactions.IsolationLevel.ReadCommitted:
                return(IsolationLevel.ReadCommitted);

            case System.Transactions.IsolationLevel.ReadUncommitted:
                return(IsolationLevel.ReadUncommitted);

            case System.Transactions.IsolationLevel.RepeatableRead:
                return(IsolationLevel.RepeatableRead);

            case System.Transactions.IsolationLevel.Serializable:
                return(IsolationLevel.Serializable);

            case System.Transactions.IsolationLevel.Snapshot:
                return(IsolationLevel.Snapshot);

            case System.Transactions.IsolationLevel.Unspecified:
                return(IsolationLevel.Unspecified);

            default:
                return(IsolationLevel.ReadCommitted);                        //default;
            }
        }
Example #2
0
        IsolationLevel GetSqlIsolationLevel(System.Transactions.IsolationLevel isolationLevel)
        {
            switch (isolationLevel)
            {
            case System.Transactions.IsolationLevel.Serializable:
                return(IsolationLevel.Serializable);

            case System.Transactions.IsolationLevel.RepeatableRead:
                return(IsolationLevel.RepeatableRead);

            case System.Transactions.IsolationLevel.ReadCommitted:
                return(IsolationLevel.ReadCommitted);

            case System.Transactions.IsolationLevel.ReadUncommitted:
                return(IsolationLevel.ReadUncommitted);

            case System.Transactions.IsolationLevel.Snapshot:
                return(IsolationLevel.Snapshot);

            case System.Transactions.IsolationLevel.Chaos:
                return(IsolationLevel.Chaos);

            case System.Transactions.IsolationLevel.Unspecified:
                return(IsolationLevel.Unspecified);
            }

            return(IsolationLevel.ReadCommitted);
        }
Example #3
0
        internal static IsolationLevel AsDataIsolationLevel(this System.Transactions.IsolationLevel level)
        {
            switch (level)
            {
            case System.Transactions.IsolationLevel.Chaos:
                return(IsolationLevel.Chaos);

            case System.Transactions.IsolationLevel.ReadCommitted:
                return(IsolationLevel.ReadCommitted);

            case System.Transactions.IsolationLevel.ReadUncommitted:
                return(IsolationLevel.ReadUncommitted);

            case System.Transactions.IsolationLevel.RepeatableRead:
                return(IsolationLevel.RepeatableRead);

            case System.Transactions.IsolationLevel.Serializable:
                return(IsolationLevel.Serializable);

            default:
                return(IsolationLevel.Unspecified);
            }
        }