Class design help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SamIAm

    #1

    Class design help

    Hi

    I am looking at implementing a Facade architecture in my system. i.e
    MyBusinessFacde System and multiple MyBusinessObjec ts
    I want the MyBusinssObject class to only be created by the
    MyBusinessFacde System class.
    i.e
    using System;

    namespace FacadeTest.MyFa cade
    {
    /// <summary>
    /// Summary description for MyFacadeSystem.
    /// </summary>
    public class MyFacadeSystem
    {
    private MyBusinessObjec t_MyBusinessObj ect = null;

    public MyFacadeSystem( )
    {
    _MyBusinessObje ct= new MyBusinessObjec t();
    }

    public MyBusinessObjec ts MyBusinessObjec tsBLL
    {
    get
    {
    return _MyBusinessObje cts;
    }
    }

    }
    }

    How do I set the accessability if the MyBusinessObjec t class i.e.:
    using System;

    namespace FacadeTest.MyFa cade
    {
    /// <summary>
    /// Summary description for MyBusinessObjec t .
    /// </summary>
    internal class MyBusinessObjec t
    {
    public MyBusinessObjec t ()
    {
    }

    public string SomeMethod(){
    return "Hello";

    }
    }
    }




    Hope that is clear,



    S


  • Mark

    #2
    Re: Class design help

    Hi Sam

    Everything you had was correct except for the modifier for the constructor
    for MyBusinessObjec t. You need to make the modifier Internal so only your
    facade can create it. To really ensure only the facade is creating it then
    you could also pass in a parameter to the construtor or test the caller :)

    Mark

    "SamIAm" <samiam@rubbach icken.com> wrote in message
    news:%23HNanmDc DHA.656@tk2msft ngp13.phx.gbl.. .[color=blue]
    > Hi
    >
    > I am looking at implementing a Facade architecture in my system. i.e
    > MyBusinessFacde System and multiple MyBusinessObjec ts
    > I want the MyBusinssObject class to only be created by the
    > MyBusinessFacde System class.
    > i.e
    > using System;
    >
    > namespace FacadeTest.MyFa cade
    > {
    > /// <summary>
    > /// Summary description for MyFacadeSystem.
    > /// </summary>
    > public class MyFacadeSystem
    > {
    > private MyBusinessObjec t_MyBusinessObj ect = null;
    >
    > public MyFacadeSystem( )
    > {
    > _MyBusinessObje ct= new MyBusinessObjec t();
    > }
    >
    > public MyBusinessObjec ts MyBusinessObjec tsBLL
    > {
    > get
    > {
    > return _MyBusinessObje cts;
    > }
    > }
    >
    > }
    > }
    >
    > How do I set the accessability if the MyBusinessObjec t class i.e.:
    > using System;
    >
    > namespace FacadeTest.MyFa cade
    > {
    > /// <summary>
    > /// Summary description for MyBusinessObjec t .
    > /// </summary>
    > internal class MyBusinessObjec t
    > {
    > public MyBusinessObjec t ()
    > {
    > }
    >
    > public string SomeMethod(){
    > return "Hello";
    >
    > }
    > }
    > }
    >
    >
    >
    >
    > Hope that is clear,
    >
    >
    >
    > S
    >
    >[/color]


    Comment

    • SamIAm

      #3
      Re: Class design help

      Mark

      Thanks for the reply. What should I set the modifier to? I have set it to
      internal, is that ok?

      Thanks again,

      S


      "Mark" <f1fannz@hotmai l.com> wrote in message
      news:OhHPrsEcDH A.2416@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Hi Sam
      >
      > Everything you had was correct except for the modifier for the constructor
      > for MyBusinessObjec t. You need to make the modifier Internal so only your
      > facade can create it. To really ensure only the facade is creating it[/color]
      then[color=blue]
      > you could also pass in a parameter to the construtor or test the caller :)
      >
      > Mark
      >
      > "SamIAm" <samiam@rubbach icken.com> wrote in message
      > news:%23HNanmDc DHA.656@tk2msft ngp13.phx.gbl.. .[color=green]
      > > Hi
      > >
      > > I am looking at implementing a Facade architecture in my system. i.e
      > > MyBusinessFacde System and multiple MyBusinessObjec ts
      > > I want the MyBusinssObject class to only be created by the
      > > MyBusinessFacde System class.
      > > i.e
      > > using System;
      > >
      > > namespace FacadeTest.MyFa cade
      > > {
      > > /// <summary>
      > > /// Summary description for MyFacadeSystem.
      > > /// </summary>
      > > public class MyFacadeSystem
      > > {
      > > private MyBusinessObjec t_MyBusinessObj ect = null;
      > >
      > > public MyFacadeSystem( )
      > > {
      > > _MyBusinessObje ct= new MyBusinessObjec t();
      > > }
      > >
      > > public MyBusinessObjec ts MyBusinessObjec tsBLL
      > > {
      > > get
      > > {
      > > return _MyBusinessObje cts;
      > > }
      > > }
      > >
      > > }
      > > }
      > >
      > > How do I set the accessability if the MyBusinessObjec t class i.e.:
      > > using System;
      > >
      > > namespace FacadeTest.MyFa cade
      > > {
      > > /// <summary>
      > > /// Summary description for MyBusinessObjec t .
      > > /// </summary>
      > > internal class MyBusinessObjec t
      > > {
      > > public MyBusinessObjec t ()
      > > {
      > > }
      > >
      > > public string SomeMethod(){
      > > return "Hello";
      > >
      > > }
      > > }
      > > }
      > >
      > >
      > >
      > >
      > > Hope that is clear,
      > >
      > >
      > >
      > > S
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...