You have some options.
As Walaa sugested, you can just include your concatenation in the DBFunctionCall constant:
...
fields.DefineField(UserFields.FullName, 3);
fields[3].ExpressionToApply =
new DbFunctionCall("{0} + {1} + CONVERT(VARCHAR(19), {3})", new object[] {
UserFields.FullName,
" - Last login",
UserFields.LastLoginDate });
You also can use nested expressions:
fields[3].ExpressionToApply =
new Expression(
UserFields.FullName,
ExOp.Add,
new Expression(
" - Last login - ",
ExOp.Add,
new DbFunctionCall("{0} + CONVERT(VARCHAR(19), {1})", new object[] {
UserFields.LastLoginDate })));
Also, I see all your fields are from the same entity and you are not doing any aggregate, so I guess you are using DynamicList just to do this expression. If that is so, I think you also can use an entity fetch and write your own custom property in a partial class that return this custom expression. Example:
public partial class UserEntity
{
public string UserAndLastLoginDate
{
return string.Format("{0} - {1}- {2}", this.FullName, " - Last login - ", this.LastLoginDate);
}
}
Then when you fetch the collection, you can access your custom property:
adapter.FetchEntityCollection(users);
var someLastLoginCustom = users.First().UserAndLastLoginDate;