internal ListProperty(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_LIST> > getterExpression, Action <T_ENTITY, T_ITEM> addMethod, T_LIST list) { this.entityComparer = entityComparer; this.name = ((MemberExpression)getterExpression.Body).Member.Name; this.list = list; this.getter = getterExpression.Compile(); this.addMethod = addMethod; }
internal KeyProperty(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_PROPERTY> > getterExpression, T_PROPERTY value) : base(entityComparer, getterExpression, value) { ParameterExpression instanceParameter = getterExpression.Parameters[0]; Expression <Func <T_PROPERTY> > valueExpression = () => this.Value; this.filterExpression = Expression.Lambda <Func <T_ENTITY, bool> >(Expression.Equal(getterExpression.Body, valueExpression.Body), instanceParameter); }
public EntityPersistenceTest(IUnitOfWork unitOfWork, IUnitOfWorkFactory unitOfWorkFactory, IEntityComparer entityComparer) { ThrowIf.ArgumentIsNull(unitOfWork, "unitOfWork"); ThrowIf.ArgumentIsNull(unitOfWorkFactory, "unitOfWorkFactory"); this.unitOfWork = unitOfWork; this.unitOfWorkFactory = unitOfWorkFactory; this.entityComparer = entityComparer; }
internal ListProperty(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_LIST> > getterExpression, T_LIST list) { this.entityComparer = entityComparer; this.name = ((MemberExpression)getterExpression.Body).Member.Name; this.list = list; this.getter = getterExpression.Compile(); ParameterExpression instanceParameter = getterExpression.Parameters[0]; ParameterExpression valueParameter = Expression.Parameter(typeof(T_LIST), "value"); this.setter = Expression.Lambda <Action <T_ENTITY, T_LIST> >(Expression.Assign(getterExpression.Body, valueParameter), instanceParameter, valueParameter).Compile(); }
public static ConnectedProjectionTestSpecification <TContext> Expect <TContext, TEntity>( this ConnectedProjectionScenario <TContext> scenario, IEntityComparer <TEntity> comparer, Func <TContext, IQueryable <TEntity> > query, params TEntity[] expectedEntities) where TEntity : class { return(scenario.Verify(async ctx => { var actualEntities = await query(ctx).ToListAsync(); if (actualEntities.Count != expectedEntities.Length) { return VerificationResult.Fail( $" Expected {expectedEntities.Length} entities, but found {actualEntities.Count} entities. {actualEntities.ToLogStringLimited(max: 10)}"); } var differences = expectedEntities .Zip(actualEntities, (expected, actual) => new { expected, actual }) .SelectMany(x => comparer.Compare(x.expected, x.actual)) .ToList(); using (var writer = new StringWriter()) { writer.WriteLine(" Expected: {0} entities ({1}),", expectedEntities.Length, expectedEntities.ToLogStringLimited(max: 10)); if (!differences.Any()) { writer.WriteLine(" Actual: {0} entities ({1}),", actualEntities.Count, actualEntities.ToLogStringLimited(max: 10)); return VerificationResult.Pass(writer.ToString()); } writer.WriteLine(" But found the following differences:"); foreach (var difference in differences) { writer.WriteLine(" {0}", difference.Message); } return VerificationResult.Fail(writer.ToString()); } })); }
internal Property(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_PROPERTY> > getterExpression, T_PROPERTY value, bool isReadOnly) { this.EntityComparer = entityComparer; this.name = ((MemberExpression)getterExpression.Body).Member.Name; this.isReadOnly = isReadOnly; this.value = value; this.getter = getterExpression.Compile(); if (!this.isReadOnly) { ParameterExpression instanceParameter = getterExpression.Parameters[0]; ParameterExpression valueParameter = Expression.Parameter(typeof(T_PROPERTY), "value"); this.setter = Expression.Lambda <Action <T_ENTITY, T_PROPERTY> >(Expression.Assign(getterExpression.Body, valueParameter), instanceParameter, valueParameter).Compile(); } }
internal KeyReferenceProperty(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_REFERENCE_ENTITY> > getterExpression, T_REFERENCE_ENTITY value) : base(entityComparer, getterExpression, value) { }
internal ReferenceProperty(IEntityComparer entityComparer, Expression <Func <TEntity, TReferenceEntity> > getterExpression, TReferenceEntity value) : base(entityComparer, getterExpression, value) { }
public CsvFileReader(IEntityComparer entityComparer) { _comparer = entityComparer; }
internal Property(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_PROPERTY> > getterExpression, T_PROPERTY value) : this(entityComparer, getterExpression, value, false) { }
/// <summary> /// Initializes a new instance of the <see cref="ChangeCollector{TKey, TEntity}"/> class. /// </summary> /// <param name="entityComparer">The entity comparer.</param> public ChangeCollector(IEntityComparer entityComparer) { _entityComparer = entityComparer; }
internal IdentityKeyProperty(IEntityComparer entityComparer, Expression <Func <T_ENTITY, T_PROPERTY> > getterExpression) : base(entityComparer, getterExpression, default(T_PROPERTY)) { }
public ResxFileReader(IEntityComparer entityComparer) { _comparer = entityComparer; }