Open Closed

Question about nested transaction behaviour #93


0
bvz created

I have reat the Unit Of Work documentation page, however, I have a question.

Consider this code:

public EntUserUnit AddUserUnit(EntUserUnit userUnit)
        {            
            Context.UserUnits.Add(userUnit);
            return userUnit;
        }

        public List<EntUserUnit> AddUserUnits(List<EntUserUnit> userUnits)
        {
            return userUnits.Select(AddUserUnit).ToList();
        }

This code is in an Application Service. The documentation states that a transaction will be started when I call theAddUserUnits(List

If I send a list with 10 objects, will they all be added in the same transaction? If any one of them fails, will they all be rolled back?


1 Answer(s)