Esempio n. 1
0
        private static object CreateAndInsertEntity(ITable table, IList <MemberBinding> memberBindings, Transaction transaction)
        {
            object newEntity = Effort.Shared.Internal.CreateEntityHelper.Create(table, memberBindings);

            DatabaseReflectionHelper.InsertEntity(table, newEntity, transaction);

            return(newEntity);
        }
Esempio n. 2
0
        private static object CreateAndInsertEntity(ITable table, IList <MemberBinding> memberBindings, Transaction transaction)
        {
            LambdaExpression expression =
                Expression.Lambda(
                    Expression.MemberInit(
                        Expression.New(table.EntityType),
                        memberBindings));

            Delegate factory = expression.Compile();

            object newEntity = factory.DynamicInvoke();

            DatabaseReflectionHelper.InsertEntity(table, newEntity, transaction);

            return(newEntity);
        }