Step 3: Specifying Local or Web Service Data Access

There are several different ways you can specify which type of data access classes your business objects use to retrieve and manipulate data.

  • You can add a DefaultDataAccessMode setting to your app.config or web.config file as shown here (currently, the only valid values are "local", "wcf" and "webservice"):

      <appSettings>
         <!-- Specifies the default data acccess model: "local" or "webservice" -->
         <add key="DefaultDataAccessMode" value="webservice" />
       </appSettings>

  • You can set mmAppBase.DefaultDataAccessMode programatically when your application first starts up.

    For example, you may want to add an option to a Windows User Login form that allows the user to specify whether they want to connect locally or remotely:

    In the handler for the radio buttons you can place code that sets the application's default access mode:

    private void rdoLocalData_CheckedChanged(object sender, EventArgs e)
    {
    	mmAppBase.DefaultDataAccessMode = mmDataAccessMode.Local;
    }
    
    private void rdoWebService_CheckedChanged(object sender, EventArgs e)
    {
    	mmAppBase.DefaultDataAccessMode = mmDataAccessMode.WebService;
    }

  • You can also override a specific business object's CreateDataAccessObject() method to instantiate one or the other type of data access class.

© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/29/08
Comment or report problem with topic