-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Issue by ChristopheL77
Wednesday Jan 06, 2016 at 14:31 GMT
Originally opened as NDbUnit#60
I tried using NDbUnit to test Workflow Foundation 4.
WF4 uses tables with schema [System.Activities.DurableInstancing]
For example, with a table named [System.Activities.DurableInstancing].DefinitionIdentityTable, NDBUnit will fail because it splits table name with dot and then rewrites it like this : [System].[Activities].[DurableInstancing].[DefinitionIdentityTable].
I debugged a little and the method that creates the table name is : TableNameHelper.FormatTableName.
The following code works for SQLServer for tables with a schema and a table name but should be extended to support other DBMS or with tables containing database name :
`
Regex quotedExpr = new Regex(@"^((?'ns'[(\w+.)*(\w+)]).)?(([(?'tn'\w+)])|(?'tn'\w+))$");
Match match = quotedExpr.Match(declaredTableName);
string nmspace = null;
string tableName = null;
if (match != null && match.Success)
{
if (match.Groups["ns"].Length != 0)
{
nmspace = match.Groups["ns"].Value;
}
tableName = match.Groups["tn"].Value;
StringBuilder result = new StringBuilder();
if (nmspace != null)
{
result.Append(nmspace);
result.Append(".");
}
result.AppendFormat("[{0}]", tableName);
return result.ToString();
}
`