Creating a Dupe Check Class
The following steps provide an overview of how to write a duplicate check object for Aptify:
If using the template provided by Aptify for this project, configure the template as described in Loading the Sample Code and Templates, rename the project and class as necessary, and skip to Step 9
- Open a new Class Library project in Visual Studio.
- Configure the Properties for the project.
- When assigning an assembly name for this object, use this format: [EntityName]DupeCheck (remove spaces in the entity name). For example: VehicleModelsDupeCheck (or SampleVehicleModelsDupeCheck, as shown below).
- Specify a root namespace for your project. For example: Aptify.SampleApplication.MotorLoaner, as shown below.
- Click the References tab in the Properties page and add a reference to the following Aptify objects:
- AptifyApplication
- AptifyAttributeManagement
- AptifyExceptionManagement
- AptifyGenericDataServices
- AptifyGenericEntityBase
IAptifyDataServices
References to the following Microsoft Objects should already exist in the project: System, System.Data, and System.Xml. You can find the Aptify objects in your Aptify Windows application's C:\Program Files\Aptify 5.5 directory.
- Open the class file.
- Add Option Explicit On and Option Strict On at the top of the class file (as described in Use Option Explicit and Option Strict.
- Import the following namespaces into the class:
- Aptify.Framework.BusinessLogic.GenericEntity
- Aptify.Framework.DataServices
- Aptify.Framework.Application
- Define the name for your class (typically this is Public Class [Object Name]).
- Add Implements IAptifyDuplicateCheck below the class name to specify that this class will implement that interface to create a duplicate check object.
- Write a function to implement the CheckForDuplicate method for your object.
- As described previously, Aptify recommends that you write a stored procedure to check for matching records and add this stored procedure to the database. The stored procedure should receive its input parameters from your CheckForDuplicate function.
- See About the Sample Application Duplicate Check Objects, the sample application source code, and Use Stored Procedures to Retrieve Database Values for more information and examples.
- If you are planning to use the standard Duplicate Check dialog box, configure the DuplicateMessageObject Property to Return Nothing.
- See the sample applicable source code for examples.
- Build, test, and sign the assembly. See Best Practices When Writing Code for Aptify for details.
- See Adding a Duplicate Check Plug-In Object to an Entities Record for instructions on how to add the object to the Aptify system.
Related topics
Copyright © 2014-2019 Aptify - Confidential and Proprietary