You are viewing limited content. For full access, please sign in.

Question

Question

C# application configuration in workflow

asked on May 1, 2015 Show version history

I'm working on applying a customized data access layer to workflow scripts.

I'm trying to create my own c# applications as .dll files and reference them in the workflow script.

One of the challenge is to apply application configration (app.config) to a workflow script(looks to me like a c# project). Is there a way to do that?

0 0

Replies

replied on May 1, 2015

That's not supported. What are you really trying to do?

0 0
replied on May 1, 2015

I'm trying to apply a data access layer that allow accessing database but not using data profile provided by WF.

However, using MS frameworks such EnterpriceLibrary will require using XML configuration for logging, error handling and other kinds of features. Also, I want to save the connection string in configuration files instead of hard code it.

0 0
replied on May 2, 2015

If I understand correctly you want to open and retrieve values from a custom XML based config file in a workflow script.  Here is a link to a Microsoft article on using custom configuration files.  I tested this in a Workflow Script activity and indeed I can open the config file and parse it for configuration information. 

You should be able to modify this code to achieve your goal.  (The example is in VB but you should be able to modify for C#)...

https://support.microsoft.com/en-us/kb/321585/

 

0 0
replied on May 4, 2015

See the Call Program sample in the Workflow SDK documentation. You can have a custom activity that runs your customer program.

0 0
replied on May 4, 2015

Thanks for the reply.

Can you point me to that documentation? I'm using Laserfiche SDK 9.1 Tutorial and API. I can't find the sample you are talking about.

0 0
replied on May 4, 2015

It's the Workflow SDK, not the Laserfiche one. It's part of your Workflow installation. If you already have it installed, the samples are in C:\Program Files (x86)\Laserfiche\Laserfiche Workflow 9\SDK. If you don't have it installed, modify your Workflow installation and add the feature.

0 0
replied on May 5, 2015

Sounds like you are trying to create a Class Library for reference within your project. Typically app.config files are applied by default to an executed assembly (like a console application or a forms application, or a web application in the case of a web.config file). These app.config files are really just plain xml configuration files that .NET framework classes happen to provide facilitated access to (via classes like ConfigurationManager). The only thing that is somewhat special about app.config is that the file is renamed to have the same name as its assembly after compilation (ie if your project is called MyProject.dll, the config will be called MyProject.dll.config). All that said, none of this is necessary to configure your project using a configuration file.

 

For your own assemblies, you can just as well use a different config file that behaves just like the app.config, and then map to that config file. The method you want to use is ConfigurationManager.OpenMappedExeConfiguration (though there are many others you can also use to get the job done).  Here is a link to the MSDN, though you might want to look for other references too https://msdn.microsoft.com/en-us/library/ms134269(v=vs.110).aspx

 

You could of course just not use ConfigurationManager, and instead configure this yourself in any arbitrary .xml or .txt file and use basic file I/O; as long as the files are somewhere the Workflow Server can access, there is nothing stopping you from reading/writing a file.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.