-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move DomainServiceEndpointRoutePatternAttribute to Hosting (#515)
* Fix locating linkedServerAssembly * Move DomainServiceEndpointRoutePatternAttribute to Hosting
- Loading branch information
1 parent
705d5ae
commit 94081df
Showing
6 changed files
with
42 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/OpenRiaServices.Tools/Framework/SharedCodeGenUtilities.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace OpenRiaServices.Tools | ||
{ | ||
/// <summary> | ||
/// A collection of code generation utilities. | ||
/// </summary> | ||
internal static partial class SharedCodeGenUtilities | ||
{ | ||
public static EndpointRoutePattern? TryGetRoutePatternFromAssembly(Assembly assembly) | ||
{ | ||
#if NET | ||
if(assembly?.CustomAttributes.FirstOrDefault(cad => cad.AttributeType.FullName == "OpenRiaServices.Hosting.AspNetCore.DomainServiceEndpointRoutePatternAttribute") | ||
is { ConstructorArguments: [var constructorArgument] } ) | ||
{ | ||
return (EndpointRoutePattern)Convert.ToInt32(constructorArgument.Value, CultureInfo.InvariantCulture); | ||
} | ||
return null; | ||
#else | ||
return EndpointRoutePattern.WCF; | ||
#endif | ||
} | ||
} | ||
} |