Data Object Wizard Help


Installation

Run the DataObjectWizard.msi, this will install the DataObject Wizard on your system and create an Adaptive Innovations folder in your program files folder. Once installed run the "Install Add-in" Application; this application will integrate the add-in with Visual Studio.


Requirements

The Microsoft Enterprise Library is a collection of reusable software components (application blocks) designed to assist software developers with common enterprise development cross-cutting concerns (such as logging, validation, data access, exception handling, and many others). Application blocks are a type of guidance; they are provided as source code, test cases, and documentation that can be used "as is," extended, or modified by developers to use on complex, enterprise-level line-of-business development projects.

The Data Classes built buy our Data Object Wizard will require the following references in the project where the classes reside.
  • AI.Library (provided in your install package)
  • Microsoft.Practices.EnterpriseLibrary.Common
  • Microsoft.Practices.EnterpriseLibrary.Data
  • Microsoft.Practices.EnterpriseLibrary.Logging

The .config file of your project must contain the Logging and Data application blocks. You can use the application block configuration tool provided in the Enterprise Library to create these.

Config Sections


<configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <
section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>>


Logging Application Block

<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
     <add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" source="Enterprise Library Logging" formatter="Text Formatter" log="" machineName="." traceOutputOptions="None" />
    </listeners>
    <formatters>
        <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}" name="Text Formatter" />
    </formatters>
    <categorySources>
        <add switchValue="All" name="General">
            <listeners>
                <add name="Event Log Listener" />
            </listeners>
        </add>
    </categorySources>
    <specialSources>
        <allEvents switchValue="All" name="All Events" />
        <notProcessed switchValue="All" name="Unprocessed Category" />
        <errors switchValue="All" name="Logging Errors &amp; Warnings">
            <listeners>
                <add name="Event Log Listener" />
            </listeners>
        </errors>
    </specialSources>
</loggingConfiguration>


Data Application Block

<connectionStrings>
    <add name="Keyname" connectionString="Database=DatabaseName; Server=ServerName;User ID=UserID;Pwd=Password;" providerName="System.Data.SqlClient" />
</
connectionStrings>




Usage

The Data Object Wizard 2010 will simplify your connections to your databases and provide a list of easy to use objects with which to read and write data.

Software Development Tool, visual studio add-in, custom software

To begin using the DOW2010, open a project and select Data Object Wizard from the Tools Menu.

Update the Server, Login and Password information and a list of databases will populate under the Database Drop Down.

Select your database and then select the Project that you want the classes to be inserted into.

Change the prefixes to your preferences.

Finally, the filters will help you limit the search performed when creating a class for a specific database item.





Click Next to select the database items you wish to build the classes.



Software Development Tool, visual studio add-in, custom software


You can further filter on this screen as well if there are too many items in the selection.

Make your selection of which items to build the classes and click next.

















Software Development Tool, visual studio add-in, custom software


Then you will need to specify the Base Registry that the DOW2010 will read from as well as any SubKeys that you wish to add.
The Database Name will be entered into the registry that will match the database setup in your config document.

You can also choose to change the class type, add a namespace, set the command timeout and choose the output language.





Clicking next will generate the classes themselves. It will automatically check out files if you are using a source control and will prompt to overwrite if the file already exists.






The objects are then referenced in the code in the following manner:

Visual Basic

DataObject:

Dim objPrice As New proc_mms_ProspectShared_ShowPlanPricing()
objPrice.Fields.PlanID = PlanID
objPrice.Execute()
With objPrice.Fields
    txtPriceTrial.Text = .PriceTrial.ToString
    txtPriceShipping.Text =.PriceShipping
    txtPriceApp.Text =.PriceApp
    txtPriceMonth.Text =.PricePlan
End With


DataSet:

Dim ds as DataSet Dim objGetRefs As New proc_All_includes_ListStates()
objGetRefs.RefType = "ATYPE"
ds = objGetRefs.ExecuteDataSet

C#

DataObject:

proc_mms_ProspectShared_ShowPlanPricing objPrice = new proc_mms_ProspectShared_ShowPlanPricing();
objPrice.Fields.PlanID = PlanID;
objPrice.Execute();
txtPriceTrial.Text = objPrice.Fields.PriceTrial.ToString();
txtPriceShipping.Text = objPrice.Fields.PriceShipping;
txtPriceApp.Text = objPrice.Fields.PriceApp;
txtPriceMonth.Text = objPrice.Fields.PricePlan;


DataSet:

DataSet ds = null;
proc_All_includes_ListStates objGetRefs = new proc_All_includes_ListStates();
objGetRefs.RefType = "ATYPE";
ds = objGetRefs.ExecuteDataSet;