Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using FooService.Data.BarServiceReference;
- public class FooData : IFooData
- {
- public BarDto Func1(int id)
- {
- try
- {
- using (BarServiceClient client = new BarServiceClient())
- {
- return client.GetBar(id);
- }
- }
- catch (System.ServiceModel.FaultException ex)
- {
- throw new Exception($"Inner exception in BarServiceClient: { ex.Message }", ex);
- }
- }
- }
- public class FooLogic
- {
- private IMapper Mapper { get; }
- private IFooData FooData { get; }
- public FooLogic(IMapper mapper, IFooData fooData)
- {
- Mapper = mapper;
- FooData = fooData;
- }
- public Bar GetBar(int id)
- {
- BarDto barDto = FooData.Func1(itemId);
- Bar bar = Mapper.Map<BarDto, Bar>(barDto);
- // There are lot more, taken from the Data layer.
- // Some operations are performed. The Bar is basically modified a little bit/adjusted
- return bar;
- }
- }
Add Comment
Please, Sign In to add comment