Interop page of Visual Studio project properties (Synergy .NET)
Use the Interop page of project properties in Visual Studio to set options that affect the way wrapper classes are generated for a Synergy .NET Interop project and whether pooling will be used.
To access the Interop page, select a project node in Solution Explorer, select Project > Properties from the Visual Studio menu, and then select the Interop tab. This page is available only for Synergy/DE Interop projects.
Note the following:
- Wrapper classes are generated whenever the project is built (with Build > Build Solution, with Build > Rebuild Solution, or from the command line with MSBuild). These classes are generated to files in a folder named GenerateCode. The GenerateCode folder and its files are displayed in Solution Explorer, but to prevent unnecessary source control changes, they are not actually part of the solution. Clean Solution (in the Build menu) removes the GenerateCode folder and files in it.
- Errors in code generation do not cause a build to fail, but are logged in the Error List as warnings.
- If repository files are not in the locations specified by RPSMFIL and RPSTFIL (or RPSDAT), use a repository project (see Using Synergy/DE repositories in Visual Studio), or use the Environment Variables page of Visual Studio project properties or the Common Properties page of Visual Studio project properties to set the DBLNET2XML_RPS environment variable to the full file specifications for the repository main and text files, separated by a comma. If the repository files cannot be located, wrapper classes will not be generated, and you will get a warning: “dblnet2xml failed to create XML file.” See DBL2XML_RPS for more information.
See Preparing Existing Code for Synergy .NET for information on converting xfServerPlus routines for native .NET access. See Performing Common Synergy .NET Coding Tasks for information on calling a routine in a Synergy assembly from another .NET assembly.
Interop Project Settings
Generate structure members as
Specify whether structure members should be generated as properties with private fields (the “Properties” option) or as public fields (the “Fields” option). If you are planning to use .NET controls, select Properties; the properties have “get” and “set” methods, which can be assigned to .NET controls. You must generate properties to take advantage of Repository’s read-only flag and the class Changed property.
Generate out parameters as
Specify whether “out” parameters should be generated as ref types or out types. Note that arrays are always generated as ref.
Convert binary fields in repository to
Specify whether binary fields in repository structures should be created as byte arrays or strings.
Use alternate field names in repository
Select this option to use the value in the “Alternate name” field (instead of the Name field) in Repository as the property/field name. If selected, the value in the “Alternate name” field is used if it exists. If it doesn’t, the value in the Name field is used.
Generate WCF contracts
Select this option if you want the assembly to be a web service. Selecting this causes the build to generate code that makes the DLL hostable.
Use pooling
This option is deprecated.
Enables the classes in this assembly to be pooled. This option causes the generated procedural classes to be derived from the ServicedComponent class. It also changes the status of some methods from public to private or protected. Thus, you should select “Use pooling” only when you are certain the object will be pooled.
Return to pool
This option is deprecated.
True specifies that pooled objects should be returned to the pool after they are used. False specifies that they should be discarded after use.
Enable AppDomain support with MarshalByRefObject
Select this option if you want generated classes to inherit from MarshalByRefObject. This option makes it easier to use generated classes with AppDomains (which are generally required for multi-threaded environments).
This option cannot be used with the “Use pooling” option.
Generate utility method stubs
Select this option if you want the generated component class to include stubs for the utility methods (connect, disconnect, etc.) that were included in your procedural classes when you originally built your assembly in xfNetLink .NET. These methods have no purpose in a Synergy/DE Interop project, but stubs for these methods enable you to run code written for xfNetLink .NETwithout having to remove calls to the utility methods.
Generate structures with INotifyPropertyChanged events
Select this option to include the INotifyPropertyChanged class in generated structure classes. This enables you to use the PropertyChanged event on structured fields (properties) bound to controls.
Generate default empty constructor
Select this option to omit constructors from generated classes. By eliminating constructors in generated classes, you can add your own constructors to partial classes. Note that the gencs utility always includes constructors.
Generate with IDisposable
Select this option if you want generated component classes to include stubs for methods that implement IDisposable (which is used for pooling in xfNetLink .NET). This enables you to run code written for xfNetLink .NET without having to remove calls to these methods.