<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
using System.Threading.Tasks;

namespace Wodsoft.ComBoost
{
    public class DomainServiceAccessor : IDomainServiceAccessor
    {
#if NET451        
        private static readonly string LogicalDataKey = "__DomainService_Current__" + AppDomain.CurrentDomain.Id;

        public IDomainService DomainService
        {
            get
            {
                var handle = CallContext.LogicalGetData(LogicalDataKey) as ObjectHandle;
                return handle?.Unwrap() as IDomainService;
            }
            set
            {
                CallContext.LogicalSetData(LogicalDataKey, new ObjectHandle(value));
            }
        }
#else
        System.Threading.AsyncLocal<IDomainService> _Context = new System.Threading.AsyncLocal<IDomainService>();
        public IDomainService DomainService
        {
            get { return _Context.Value; }
            set { _Context.Value = value; }<commit_msg>添加NET451判断<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
#if NET451
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
#endif
using System.Threading.Tasks;

namespace Wodsoft.ComBoost
{
    public class DomainServiceAccessor : IDomainServiceAccessor
    {
#if NET451
        private static readonly string LogicalDataKey = "__DomainService_Current__" + AppDomain.CurrentDomain.Id;

        public IDomainService DomainService
        {
            get
            {
                var handle = CallContext.LogicalGetData(LogicalDataKey) as ObjectHandle;
                return handle?.Unwrap() as IDomainService;
            }
            set
            {
                CallContext.LogicalSetData(LogicalDataKey, new ObjectHandle(value));
            }
        }
#else
        System.Threading.AsyncLocal<IDomainService> _Context = new System.Threading.AsyncLocal<IDomainService>();
        public IDomainService DomainService
        {
            get { return _Context.Value; }
            set { _Context.Value = value; }
{'fraction_non_alphanumeric': 0.07318202871699861, 'fraction_numerical': 0.00555812876331635, 'mean_word_length': 2.4394904458598727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '519628', 'n_tokens_mistral': 585, 'n_tokens_neox': 573, 'n_words': 119}