Skip to content

Commit 8d9f68f

Browse files
committed
Merge branch 'release-1.7'
2 parents b2ca9fe + 49b136c commit 8d9f68f

File tree

15 files changed

+115
-379
lines changed

15 files changed

+115
-379
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,13 @@ $RECYCLE.BIN/
153153

154154
# Mac desktop service store files
155155
.DS_Store
156+
157+
# NuGet Packages
158+
*.nupkg
159+
# The packages folder can be ignored because of Package Restore
160+
**/packages/*
161+
# except build/, which is used as an MSBuild target.
162+
!**/packages/build/
163+
# Uncomment if necessary however generally it will be regenerated when needed
164+
!**/packages/repositories.config
165+

Src/SetProperty/BizTalkComponents.PipelineComponents.SetProperty.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,18 @@
3939
<AssemblyOriginatorKeyFile>BizTalkComponents.SetProperty.snk</AssemblyOriginatorKeyFile>
4040
</PropertyGroup>
4141
<ItemGroup>
42+
<Reference Include="Microsoft.BizTalk.GlobalPropertySchemas, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft BizTalk Server 2013\Microsoft.BizTalk.GlobalPropertySchemas.dll</HintPath>
45+
</Reference>
4246
<Reference Include="Microsoft.BizTalk.Pipeline, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4347
<SpecificVersion>False</SpecificVersion>
4448
<HintPath>..\..\..\..\..\Windows\assembly\GAC_MSIL\Microsoft.BizTalk.Pipeline\3.0.1.0__31bf3856ad364e35\Microsoft.BizTalk.Pipeline.dll</HintPath>
4549
</Reference>
50+
<Reference Include="Microsoft.XLANGs.BaseTypes, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
51+
<SpecificVersion>False</SpecificVersion>
52+
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft BizTalk Server 2013\Microsoft.XLANGs.BaseTypes.dll</HintPath>
53+
</Reference>
4654
<Reference Include="System" />
4755
<Reference Include="System.ComponentModel.DataAnnotations" />
4856
<Reference Include="System.Core" />

Src/SetProperty/BiztalkComponents.Utils/ContextExtensions.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,33 @@ namespace BizTalkComponents.Utils
55
{
66
public static class ContextExtensions
77
{
8-
public static bool TryRead(this IBaseMessageContext ctx ,ContextProperty property, out object val)
8+
public static bool TryRead<T>(this IBaseMessageContext ctx, ContextProperty property, out T val)
99
{
1010
if (property == null)
1111
{
1212
throw new ArgumentNullException("property");
1313
}
14+
object content = ctx.Read(property.PropertyName, property.PropertyNamespace);
15+
if (content is T)
16+
{
17+
val = (T)content;
18+
return true;
19+
}
20+
else
21+
{
22+
val = default(T);
23+
return false;
24+
}
25+
}
1426

15-
return ((val = ctx.Read(property.PropertyName, property.PropertyNamespace)) != null);
27+
public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out object val)
28+
{
29+
return TryRead<object>(ctx, property, out val);
1630
}
1731

1832
public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out string val)
1933
{
20-
if (property == null)
21-
{
22-
throw new ArgumentNullException("property");
23-
}
24-
25-
val = ctx.Read(property.PropertyName, property.PropertyNamespace) as string;
34+
TryRead<string>(ctx, property, out val);
2635

2736
return !string.IsNullOrWhiteSpace(val);
2837
}
Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,72 @@
1-
namespace BizTalkComponents.Utils
1+
using Microsoft.XLANGs.BaseTypes;
2+
3+
namespace BizTalkComponents.Utils
24
{
35
public class FileProperties
46
{
5-
public const string ReceivedFileName = "http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName";
7+
/// <summary>
8+
/// http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName
9+
/// </summary>
10+
public static readonly string ReceivedFileName = SystemProperties.GetFullyQualifiedName(new FILE.ReceivedFileName());
611
}
712

813
public class SSOTicketProperties
914
{
10-
public const string SSOTicket = "http://schemas.microsoft.com/BizTalk/2003/system-properties#SSOTicket";
15+
/// <summary>
16+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#SSOTicket
17+
/// </summary>
18+
public static readonly string SSOTicket = SystemProperties.GetFullyQualifiedName(new BTS.SSOTicket());
1119
}
1220

1321
public class SystemProperties
1422
{
15-
public const string MessageType = "http://schemas.microsoft.com/BizTalk/2003/system-properties#MessageType";
16-
public const string SchemaStrongName = "http://schemas.microsoft.com/BizTalk/2003/system-properties#SchemaStrongName";
23+
/// <summary>
24+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#MessageType
25+
/// </summary>
26+
public static readonly string MessageType = GetFullyQualifiedName(new BTS.MessageType());
27+
28+
/// <summary>
29+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#SchemaStrongName
30+
/// </summary>
31+
public static readonly string SchemaStrongName = GetFullyQualifiedName(new BTS.SchemaStrongName());
32+
33+
/// <summary>
34+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#RouteDirectToTP
35+
/// </summary>
36+
public static readonly string RouteDirectToTP = GetFullyQualifiedName(new BTS.RouteDirectToTP());
1737

18-
public const string RouteDirectToTP =
19-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#RouteDirectToTP";
38+
/// <summary>
39+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#EpmRRCorrelationToken
40+
/// </summary>
41+
public static readonly string EpmRRCorrelationToken = GetFullyQualifiedName(new BTS.EpmRRCorrelationToken());
2042

21-
public const string EpmRRCorrelationToken =
22-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#EpmRRCorrelationToken";
43+
/// <summary>
44+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#CorrelationToken
45+
/// </summary>
46+
public static readonly string CorrelationToken = GetFullyQualifiedName(new BTS.CorrelationToken());
2347

24-
public const string CorrelationToken =
25-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#CorrelationToken";
48+
/// <summary>
49+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#IsRequestResponse
50+
/// </summary>
51+
public static readonly string IsRequestResponse = GetFullyQualifiedName(new BTS.IsRequestResponse());
2652

27-
public const string IsRequestResponse =
28-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#IsRequestResponse";
53+
/// <summary>
54+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#ReqRespTransmitPipelineID
55+
/// </summary>
56+
public static readonly string ReqRespTransmitPipelineID = GetFullyQualifiedName(new BTS.ReqRespTransmitPipelineID());
2957

30-
public const string ReqRespTransmitPipelineID =
31-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#ReqRespTransmitPipelineID";
58+
public static string GetFullyQualifiedName(PropertyBase propertyBase)
59+
{
60+
var qName = propertyBase.QName;
61+
return qName.Namespace + "#" + qName.Name;
62+
}
3263
}
3364

3465
public class WCFProperties
3566
{
36-
public const string OutboundHttpStatusCode =
37-
"http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties#OutboundHttpStatusCode";
67+
/// <summary>
68+
/// http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties#OutboundHttpStatusCode
69+
/// </summary>
70+
public static readonly string OutboundHttpStatusCode = SystemProperties.GetFullyQualifiedName(new WCF.OutboundHttpStatusCode());
3871
}
3972
}

Src/SetProperty/BiztalkComponents.Utils/PropertyBagHelper.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using Microsoft.BizTalk.Component.Interop;
34

45
namespace BizTalkComponents.Utils
@@ -21,6 +22,7 @@ public static string ToStringOrDefault(object property, string defaultValue)
2122
/// <param name="pb">Property bag</param>
2223
/// <param name="propName">Name of property</param>
2324
/// <returns>Value of the property</returns>
25+
[Obsolete("Use ReadPropertyBag<T>(IPropertyBag pb, stringPropName, T oldValue instead.")]
2426
public static object ReadPropertyBag(IPropertyBag pb, string propName)
2527
{
2628
object val = null;
@@ -39,19 +41,39 @@ public static object ReadPropertyBag(IPropertyBag pb, string propName)
3941
return val;
4042
}
4143

44+
[Obsolete("Use ReadPropertyBag<T>(IPropertyBag pb, stringPropName, T oldValue instead.")]
4245
public static T ReadPropertyBag<T>(IPropertyBag pb, string propName)
4346
{
4447
try
4548
{
4649
object val;
4750
pb.Read(propName, out val, 0);
4851

52+
return val is T ? (T)val : default(T);
53+
}
54+
catch (ArgumentException)
55+
{
56+
return default(T);
57+
}
58+
catch (Exception e)
59+
{
60+
throw new ApplicationException(e.Message);
61+
}
62+
}
63+
64+
public static T ReadPropertyBag<T>(IPropertyBag pb, string propName, T oldValue)
65+
{
66+
try
67+
{
68+
object val;
69+
pb.Read(propName, out val, 0);
70+
4971
if (val == null)
5072
{
51-
return default(T);
73+
return oldValue;
5274
}
53-
54-
return (T)val;
75+
76+
return val is T ? (T)val : default(T);
5577
}
5678
catch (ArgumentException)
5779
{

Src/SetProperty/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
[assembly: AssemblyVersion("1.0.0.0")]
3636
[assembly: AssemblyFileVersion("1.0.0.0")]
37-
[assembly: AssemblyInformationalVersion("1.6.2.0")]
37+
[assembly: AssemblyInformationalVersion("1.7.0.0")]

Src/SetProperty/SetProperty.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
5858

5959
public void Load(IPropertyBag propertyBag, int errorLog)
6060
{
61-
PropertyPath = PropertyBagHelper.ReadPropertyBag<string>(propertyBag, PropertyPathPropertyName);
62-
Value = PropertyBagHelper.ReadPropertyBag<string>(propertyBag, ValuePropertyName);
63-
PromoteProperty = PropertyBagHelper.ReadPropertyBag<bool>(propertyBag, PromoteProperytName);
61+
PropertyPath = PropertyBagHelper.ReadPropertyBag(propertyBag, PropertyPathPropertyName, PropertyPath);
62+
Value = PropertyBagHelper.ReadPropertyBag(propertyBag, ValuePropertyName, Value);
63+
PromoteProperty = PropertyBagHelper.ReadPropertyBag(propertyBag, PromoteProperytName,PromoteProperty);
6464
}
6565

6666
public void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)

Src/SetProperty/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="BizTalkComponents.Utils" version="2.1.0.5" targetFramework="net40" developmentDependency="true" />
3+
<package id="BizTalkComponents.Utils" version="2.2.1.0" targetFramework="net40" developmentDependency="true" />
44
</packages>
Binary file not shown.

packages/BizTalkComponents.Utils.2.1.0.5/content/BiztalkComponents.Utils/ContextExtensions.cs

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)