/// <summary> /// Include property to the list of inserted properties with predefined value. /// </summary> /// <typeparam name="TProp"></typeparam> /// <param name="property"></param> /// <returns></returns> public virtual MergeInsertArgs <TEntity> IncludeValue <TProp>(Expression <Func <TEntity, TProp> > property, TProp value) { string propName = ReflectionUtility.GetMemberName(property); string sqlValue = ExpressionsToMSSql.ConstantToMSSql(value, typeof(TProp)); Defaults[propName] = sqlValue; _hasOtherConditions = true; return(this); }
public void then_it_returns_sql_DateObjectPropTest() { SampleEntity entity = new SampleEntity() { DateProperty = DateTime.Now }; Expression expression = Expression(p => p.DateProperty == entity.DateProperty); string sql = expression.ToMSSqlString(); string exprected = $"[{ExpressionsToMSSql.ALIASES[0]}].[DateProperty] = " + ExpressionsToMSSql.ConstantToMSSql(entity.DateProperty, typeof(DateTime)); Assert.AreEqual(exprected, sql); }