Transfer Objects and Business Objects, Inconsistent Accessibility

Last post 03-05-2007 2:58 PM by Javier Luna. 1 replies.

Sort Posts:

  • Transfer Objects and Business Objects, Inconsistent Accessibility

    02-28-2007, 4:38 PM
    • Member
      point Member
    • mariano774
    • Member since 07-23-2003, 11:40 AM
    • Posts 1

    Hello,

    I'm building a POC architecture framework, in which I have my business objects (BOs) made of internal classes and my transfer objects (TOs) made of public classes.
    what I'd like to do is have a constructor for each TO and use the BO as a parameter, so to build the TO using the BO
    what I coded is this:

    public class ClientTO {
      public string name;

      public ClientTO(ClientBO client) {
        this.name = client.name;
      }
    }

    The problem is that ClientBO is internal and ClientTO is public, so it gives a compilation error "inconsistent accessibility: parameter type ClientBO is less accessible than method ClientTO(ClientBO)"

    any ideas? I don't to make my BOs public so to force programmers to use TOs

    thanks in advance,
    mariano

  • Re: Transfer Objects and Business Objects, Inconsistent Accessibility

    03-05-2007, 2:58 PM
    • Contributor
      2,426 point Contributor
    • Javier Luna
    • Member since 08-29-2006, 12:34 PM
    • Lima, Peru
    • Posts 592

    You would have to use in your constructor:

    public ClientTO( String name )
    {
       this.name = name;
    }

    Because you current constructor has reference to ClientBO. If ClientBO will be internal class your programmers never see it.

    from Villa El Salvador for world!
Page 1 of 1 (2 items)