Skip to content

Commit

Permalink
fix some more tests, default to WCF uri's since we use same baseline …
Browse files Browse the repository at this point in the history
…for .NET and .NET FRAMEWORK
  • Loading branch information
Daniel-Svensson committed Jun 6, 2024
1 parent 403bbf9 commit 2a598ec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal string GenerateCode(ClientCodeGenerationOptions options, SharedCodeServ
#if NET
// If the server assembly has a DomainServiceEndpointRoutePatternAttribute, we use it to set the default EndpointRoutePattern
Assembly linkedServerAssembly = AssemblyUtilities.LoadAssembly(parameters.ServerAssemblies.First() + ".dll", loggingService);
if (linkedServerAssembly.GetCustomAttribute<DomainServiceEndpointRoutePatternAttribute>() is { } routeAttribute)
if (linkedServerAssembly?.GetCustomAttribute<DomainServiceEndpointRoutePatternAttribute>() is { } routeAttribute)
{
options.DefaultEndpointRoutePattern = (EndpointRoutePattern)(int)routeAttribute.EndpointRoutePattern;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ public string Language
/// </remarks>
public bool UseFullTypeNames { get; set; }

#if NET

/// <summary>
/// <see cref="Server.EndpointRoutePattern"/> determining how default Uri's for accessing DomainServices are generated.
/// See "Server.EndpointRoutePattern" determining how default Uri's for accessing DomainServices are generated.
/// </summary>
public EndpointRoutePattern DefaultEndpointRoutePattern { get; set; } = EndpointRoutePattern.FullName;
public EndpointRoutePattern DefaultEndpointRoutePattern { get; set; }
#if NET
= EndpointRoutePattern.FullName;
#else
= EndpointRoutePattern.WCF;
#endif

}
Expand Down
8 changes: 5 additions & 3 deletions src/OpenRiaServices.Tools/Framework/EndpointRoutePattern.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
namespace OpenRiaServices.Tools
#if NETFRAMEWORK
#pragma warning disable 1574 // Server.EndpointRoutePattern is not available
#endif

namespace OpenRiaServices.Tools
{
#if NET
/// <summary>
/// IMPORTANT: THIS IS AN EXACT copy of <see cref="Server.EndpointRoutePattern"/> where all values are identical.
/// We don't use the server version in the options because we don't want to load in the Server assembly until a bit later
Expand All @@ -23,5 +26,4 @@ public enum EndpointRoutePattern
/// </summary>
WCF
}
#endif
}
2 changes: 2 additions & 0 deletions src/OpenRiaServices.Tools/Test/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ internal static string ValidateLanguageCodeGen(CodeGenValidationOptions codeGenO
ClientRootNamespace = codeGenOptions.RootNamespace,
ClientProjectPath = "MockProject.proj",
IsApplicationContextGenerationEnabled = codeGenOptions.GenerateApplicationContexts,
// Since we use the same baseline for NETFRAMEWORK and NET we need to set the same endpoint pattern for both
DefaultEndpointRoutePattern = EndpointRoutePattern.WCF,
UseFullTypeNames = codeGenOptions.UseFullTypeNames,
ClientProjectTargetPlatform = TargetPlatform.Silverlight
};
Expand Down
2 changes: 1 addition & 1 deletion src/Test/AspNetCoreWebsite/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using RootNamespace.TestNamespace;
using TestDomainServices.Testing;

//[assembly: DomainServiceEndpointRoutePattern(EndpointRoutePattern.FullName)]
[assembly: DomainServiceEndpointRoutePattern(EndpointRoutePattern.FullName)]

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenRiaServices();
Expand Down

0 comments on commit 2a598ec

Please sign in to comment.