public FieldUpdateValue( Func <TEntity, TProperty> newValue, Expression <Func <TDbValue, TProperty> > dbValue, Func <TProperty, TProperty, bool> compareValue) { this.newValue = newValue; this.dbValue = dbValue.Compile(); this.compareValue = compareValue; this.setValue = ExpressionUtils.CreateSetter(dbValue); }
public void CreateDefaultConstructorTest() { var defaultConstructor = ExpressionUtils.CreateDefaultConstructor <SampleClass>(); var setterIntegerProperty = ExpressionUtils.CreateSetter <SampleClass, int>(x => x.IntegerProperty); var sampleEntity = defaultConstructor(); setterIntegerProperty(sampleEntity, 1); Assert.AreEqual(1, sampleEntity.IntegerProperty); }
public void SetterTest() { var setterIntegerProperty = ExpressionUtils.CreateSetter <SampleClass, int>(x => x.IntegerProperty); var setterStringProperty = ExpressionUtils.CreateSetter <SampleClass, string>(x => x.StringProperty); SampleClass sampleClassInstance = new SampleClass(); setterIntegerProperty(sampleClassInstance, 1); setterStringProperty(sampleClassInstance, "2"); Assert.AreEqual(1, sampleClassInstance.IntegerProperty); Assert.AreEqual("2", sampleClassInstance.StringProperty); }
public UpdateManyToOne( int nodeId, bool immutable, Func <TNew, TNewProp> newProp, Expression <Func <TDbValue, TDbProp> > dbValue, IEnumerable <IUpdateValue <TNewProp, TDbProp, TChildKey> > childValues, IDiffRepository <TUserId, TChildKey, TDbProp, TNewProp> diffRepository) : base(nodeId) { this.immutable = immutable; this.newProp = newProp; this.dbValue = dbValue.Compile(); this.setDbValue = ExpressionUtils.CreateSetter(dbValue); this.childValues = childValues; this.diffRepository = diffRepository; }