privatestaticstring GetDbSetString<TEntity>( MemberInitExpression memberInitExpression, Table<TEntity> table, DbCommand updateCommand ) where TEntity : class { Type entityType =typeof(TEntity); if (memberInitExpression.Type != entityType) { thrownew NotImplementedException( string.Format( "the expression should be '{0}'.", entityType ) ); } StringBuilder setSB =new StringBuilder(); string tableName = table.GetDbName(); MetaTable metaTable = table.Context.Mapping.GetTable( entityType ); var cols = from member in metaTable.RowType.DataMembers select new{ member.MappedName }; foreach ( var binding in memberInitExpression.Bindings ) { MemberAssignment assignment = binding as MemberAssignment; if ( binding ==null ) { thrownew NotImplementedException( String.Format("the property '{0}' bindings is not a type MemberAssignment.", binding.Member.Name) ); } ParameterExpression entityParam =null; ExpressionVisitor<ParameterExpression>.Visit(assignment.Expression, p => { if (p.Type == entityType) entityParam = p; return p; } ); string name = binding.Member.Name; var col = ( from c in cols where c.MappedName == name select c ).FirstOrDefault(); if ( col ==null ) { thrownew ArgumentOutOfRangeException(name, string.Format("not found the field on the {0} table", tableName)); } if (entityParam ==null) { object constant = Expression.Lambda(assignment.Expression, null).Compile().DynamicInvoke(); if (constant ==null) { setSB.AppendFormat("[{0}] = NULL, ", col.MappedName);