|
Home > Archive > BizTalk Server Orchestration > September 2004 > Scripting reference error in Biztalk 2004 Mapper
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Scripting reference error in Biztalk 2004 Mapper
|
|
| Adriaan 2004-09-02, 8:47 pm |
| Hi I am trying to use a regular Expression to remove all line feeds from a string variable in the BizTalk Mapper.
I get the following error when I compile the solution
Inline Script Error: The type or namespace name 'RegularExpressions' does not exist in the class or namespace 'System.Text' (are you missing an assembly reference?
In fact this is happening to any System.Text class I try to instanciate!!!!
My c# Inline function looks as follows
public string MyConcat(string param1)
{
return System.Text.RegularExpressions.Regex.Replace(param1, @"[^\w\.@-]", " ");
}
Any help would be appreciated
Regards
Adriaan
| |
| Martijn Hoogendoorn 2004-09-04, 5:47 pm |
| On Fri, 3 Sep 2004 14:23:08 +1200, Adriaan wrote:
> Hi I am trying to use a regular Expression to remove all line feeds from a string variable in the BizTalk Mapper.
>
> I get the following error when I compile the solution
> Inline Script Error: The type or namespace name 'RegularExpressions' does not exist in the class or namespace 'System.Text' (are you missing an assembly reference?
>
> In fact this is happening to any System.Text class I try to instanciate!!!!
>
> My c# Inline function looks as follows
>
> public string MyConcat(string param1)
> {
> return System.Text.RegularExpressions.Regex.Replace(param1, @"[^\w\.@-]", " ");
> }
>
> Any help would be appreciated
>
> Regards
>
> Adriaan
Hi Adriaan,
AFAIK this cannot be done, as you need things outside the System.* scope
and by default, the only "using" statement that's issued is "System" (this
cannot be altered or extended and is performed by
Microsoft.BizTalk.BaseFunctoids.InlineScriptCompiler).
The InlineScriptCompiler has a method called CompileScript, which is used
to compile your script into a temporary object in either implementation
language. It uses CodeDOM and wraps all scripting code for C# with,
generating a proxy dll on the fly, e.g.:
public string MyConcat(string param1)
{
return "test";
}
would become
using System;
namespace BizTalkMapper
{
public class FunctoidInlineScripts {
public string MyConcat(string param1)
{
return "test";
}
}
}
and would be compiled on the spot into an assembly by ICodeCompiler. Any
errors caused by this compilation round, is then feeded back to VS.NET.
I would implement the logic in an external assembly for re-use anyway, and
in there there's no limitation to using clauses. try this:
public string searchReplace(string input, string searchterm, string
replacement)
{
// create a regex object
Regex regex = new Regex(searchterm);
// try to perform a search/replace
string result = Regex.Replace(input, regex.ToString(),
replacement).ToString();
return result;
}
HTH,
Martijn Hoogendoorn.
|
|
|
|
|