public static async Task SetBO1_BO3_L1Async(MyBO bo, ISession s, TBO1_BO3_L value, CancellationToken cancellationToken = default(CancellationToken)) { switch (value) { case TBO1_BO3_L.Null: bo.BO1 = null; break; case TBO1_BO3_L.BO1: (await(bo.GetOrCreateBO1Async(s, cancellationToken))).BO3 = null; break; case TBO1_BO3_L.ValueNull: (await((await(bo.GetOrCreateBO1Async(s, cancellationToken))).GetOrCreateBO3Async(s, cancellationToken))).L1 = 0; // L1 is int, not int? break; case TBO1_BO3_L.Zero: (await((await(bo.GetOrCreateBO1Async(s, cancellationToken))).GetOrCreateBO3Async(s, cancellationToken))).L1 = 0; break; case TBO1_BO3_L.One: (await((await(bo.GetOrCreateBO1Async(s, cancellationToken))).GetOrCreateBO3Async(s, cancellationToken))).L1 = 1; break; default: throw new Exception("Value " + value + " not handled in code"); } }
public static void SetBO1_BO3_L1(MyBO bo, ISession s, TBO1_BO3_L value) { switch (value) { case TBO1_BO3_L.Null: bo.BO1 = null; break; case TBO1_BO3_L.BO1: bo.GetOrCreateBO1(s).BO3 = null; break; case TBO1_BO3_L.ValueNull: bo.GetOrCreateBO1(s).GetOrCreateBO3(s).L1 = 0; // L1 is int, not int? break; case TBO1_BO3_L.Zero: bo.GetOrCreateBO1(s).GetOrCreateBO3(s).L1 = 0; break; case TBO1_BO3_L.One: bo.GetOrCreateBO1(s).GetOrCreateBO3(s).L1 = 1; break; default: throw new Exception("Value " + value + " not handled in code"); } }