In this post I will explain how the WCF service can be created Using a Synergy .NET Interop undertaking. In my previous article I explained how to utilize xfNetLink .NET to make a WCF service, which provided an easy method to create a WCF support for programmers who were using xfNetLink .NET along with xfServerPlus. Now I wish to show an approach that is somewhat similar in character to you, but which does not require the continuing use of xfNetLink .NET along with xfServerPlus in ultimate solution. Of course this may not be exactly what you want if your Synergy server is still a non-Windows system.
Here is the fourth in a series of articles Several manners Synergy developers can utilize of Windows Communication Foundation (WCF) if building their software. The posts in the series are:
Building Distributed Apps with WCF along with Synergy/DE
Exposing WCF Services with xfNetLink .NET
Hosting WCF Services in an asp net hosting uk Web Application
Exposing WCF services utilizing Synergy .NET Interop (this post)
Self-Hosting WCF Services
Exposing WCF services utilizing Synergy .NET
What is Synergy .NET Interop
Before we get started we better make sure you understand exactly what a Synergy .NET Interop endeavor is. In a nutshell an Interop job is a way of developing a .NET assembly comprising a variety of classes, in which the outside interface of those classes is defined by a selection of Traditional Synergy xfServerPlus techniques, along with the Synergy records which are referenced with the parameters of those approaches. The idea is that the classes exposed by the assembly possess the specific same external interface which would be generated if those approaches were defined at a Method Catalog and subjected via xfServerPlus and xfNetLink .NET. So the main use case for the Interop meeting is to permit developers with applications that use xfNetLink .NET along with xfServerPlus to factor out those tools out of the solution, leading to a pure .NET application.
In Exactly the Same way that GENCS has an optional –W command line Switch which basically transforms the consequent .NET assembly into a WCF assistance, the Synergy .NET Interop job has a project choice which does the exact same item.
Let’s get started. Here is how to get it done. Bear in Mind, an Interop project Permits You to expose a Synergy .NET meeting based on a lot of more traditional Synergy Procedures and documents, but there are some requirements:
The Synergy approaches must make use of the introduced Documentation and attributes remarks that the external port of this technique is defined within the code. The Interop job doesn’t utilize a Synergy Method Catalog. To learn more on this you can refer to a blog post that I wrote back into 2009.
The records which are referenced by the parameters of this This would have been the case if you used xfServerPlus, although methods have to be defined in a repository.
In which the WCF service is going to soon be hosted, so that the files can be retrieved 23, should be transferred to the Windows server. If your data files need to stay on a non-Windows server of course you can use xfServer to access the files remotely.
You will Have to Have a copy of the source code for the Synergy methods to be found on the Windows development method where you’re utilizing Synergy .NET.
These are the steps that You Will Need to complete in order to Produce a Synergy .NET Interop assembly from your existing Synergy procedures and repository structure definitions:
Create an Interop Project
The first step in the process is to create a new Synergy .NET Interop Assembly job:
Open Visual Studio and create a new Synergy .NET Interop Project.
From the menu, choose File > New > Project.
From the Installed Templates list select Synergy/DE > Interop.
Put and place of the new job as needed (here I am naming the job MyInteropAssembly and setting the location to my c:temp folder).
Click the OK button to create the project.
When you create SynergyRoutines.dbl is automatically contained in the project. This document contains utility routines which are used by the interop project so as to expose the interface which xfNetLink .NET does. You shouldn’t change it, and shouldn’t need to be concerned with this particular code. Just close the document.
Insert Synergy Method Resource Files
Having made the Interop job the next step is to add The origin code to the project for your Synergy methods. Bear in mind that the techniques that you incorporate within an Interop project are Conventional Synergy subroutines and functions that contain whatever xfMethod and xfParameter characteristics are required to be able to fully record the outside port of these procedures within the source documents.
When creating an Interop job I 9, imageFor Like to add my system source files within a folder inside the undertaking, and I usually name the folder”Methods”. This is optional.
In solution Explorer, right-click in your Interop job And in the context menu select Insert > New Folder.
Change the folder’s title to Methods and press enter.
Right-click in your new Methods folder and from the circumstance Menu select Insert > Existing Item….
Use Of your Synergy process patterns, pick all of them, then click the Add button to bring the routines to your project.
In Solution Explorer your job should now look something Such as the picture on the right.
Before we move on I want to make a few things clear. Firstly it is crucial you know that if you add existing files to your project using Insert > Present Item, these files are COPIED into your job folders. If you would rather leave the source files in their current location then you can utilize Insert > Reference Present Item.
The second thing that you Will Need to understand is that at the Example I’m using here the nature of the approaches that I’m using is comparatively simple, and also the methods don’t have external dependencies on different routines in libraries, do not use include files, etc.. You need to determine how best to resolve these dependencies, if your methods do have such dependencies then.
Set Environment Variables
It’s Very Likely that you will need to set some environment Variables for your code. It’s almost sure you will need to at least set the environment variables that allow your repository to be found and obtained, and also in the event of the code that I am using, at runtime a environment variable named DAT is used to specify the location of these data files which are obtained by this code.
Synergy .NET development projects include the ability to set Environment factors in the creation environment via properties of the project:
In Solution Explorer, right click your job and out of The context menu choose Properties.
At the project properties dialog, to the left side, select The tab named Environment Variables.
Establish whatever environment factors are needed in order for Your code to compile and run.
Save the changes by choosing File > Save in the menu.
Close to the project properties dialog.
In the Event of this code I am using for this particular example I needed To place the following environmental variables:
The tools at Synergy .NET also honor the same Mechanisms for setting environment variables on the Windows platform as Synergy. Thus, if the environment variables which you want are already existing in your system environment, or are offered by the synergy.ini or synuser.ini files then you won’t have to set them .
Build an Interop Assembly
You should now have the ability to construct your interop assembly.
In Solution Explorer, click on your project and out of The context menu choose Build.