Esempio n. 1
0
 private void AddArrayExpressions <TEntity>(IExpressionBuilder expressionBuilder, CloneExpressionContext context)
 {
     context.TargetEntity = expressionBuilder.CreateObject <TEntity>(
         nameof(CloneExpressionContext.TargetEntity),
         new[] { typeof(int) },
         new[] { ExpressionFactory.Call(context.SourceEntity, ArrayLengthProperty.GetMethod) });
     expressionBuilder.For(context.SourceEntity, CloneArrayElementDelegate(context));
 }
Esempio n. 2
0
        private void AddListExpressions <TEntity>(IExpressionBuilder expressionBuilder, CloneExpressionContext context)
        {
            PropertyInfo listCountProperty = context
                                             .SourceEntity
                                             .Type
                                             .GetProperty(nameof(List <TEntity> .Count));

            context.TargetEntity = expressionBuilder.CreateObject <TEntity>(
                nameof(CloneExpressionContext.TargetEntity),
                new[] { typeof(int) },
                new[] { ExpressionFactory.Call(context.SourceEntity, listCountProperty.GetMethod) });
            expressionBuilder.For(context.SourceEntity, CloneListElementDelegate(expressionBuilder, context));
        }