Пример #1
0
        public EqualityResolver(
            EqualityContext context,
            MembersProvider membersProvider,
            IConfigurationProvider configuration)
        {
            _configuration = configuration;

            var collectionComparer = new ArrayComparisonEmitter(this, CustomEmitters.EmitCheckIfLoopsAreDone, CustomEmitters.EmitReferenceComparison);

            _comparisonFactories = new Func <IVariable, IComparisonEmitter>[] {
                variable => NullableComparison.Create(this, CustomEmitters.EmitReturnIfFalsy, CustomEmitters.EmitCheckNullablesForValue, variable),
                CeqEqualityComparison.Create,
                variable => StringsComparison.Create(StringEqualsMethod, CustomEmitters.EmitReturnIfFalsy, _configuration, variable),
                OperatorEqualityComparison.Create,
                BacisEqualityComparison.Create,
                variable => MembersComparison.Create(this, membersProvider, variable),
                variable => ArraysComparison.Create(collectionComparer, _configuration, variable),
                variable => EnumerablesComparison.Create(this, collectionComparer, CustomEmitters.EmitCheckIfLoopsAreDone, _configuration, variable),
                variable => IndirectComparison.Create(
                    CustomEmitters.EmitReturnIfFalsy,
                    context.GetStaticEqualsMethodInfo,
                    DelayedEquals,
                    variable)
            };
        }
        public HasherResolver(EqualityContext context, MembersProvider membersProvider, IConfigurationProvider configuration)
        {
            _configuration = configuration;

            _hashersFactories = new Func <IVariable, IHasherEmitter>[] {
                variable => NullableHasher.Create(this, variable),
                variable => StringHasher.Create(_configuration, variable),
                BasicHasher.Create,
                variable => MembersHasher.Create(this, membersProvider, _configuration, variable),
                variable => ArrayHasher.Create(this, _configuration, variable),
                variable => EnumerablesHasher.Create(this, _configuration, variable),
                variable => IndirectHasher.Create(context, variable)
            };
        }