-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allowed
null
Namespace for Framework Types
Co-authored-by: Mike-E <michael@dragonspark.network>
- Loading branch information
1 parent
6d6b363
commit ffd3a89
Showing
1 changed file
with
6 additions
and
16 deletions.
There are no files selected for viewing
22 changes: 6 additions & 16 deletions
22
src/ExtendedXmlSerializer/ContentModel/Reflection/PartitionedTypeSpecification.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 |
---|---|---|
@@ -1,30 +1,20 @@ | ||
using ExtendedXmlSerializer.Core.Specifications; | ||
using System.Reflection; | ||
|
||
namespace ExtendedXmlSerializer.ContentModel.Reflection | ||
{ | ||
sealed class PartitionedTypeSpecification | ||
: DecoratedSpecification<TypeInfo>, | ||
IPartitionedTypeSpecification | ||
sealed class PartitionedTypeSpecification : IPartitionedTypeSpecification | ||
{ | ||
public static PartitionedTypeSpecification Default { get; } = new PartitionedTypeSpecification(); | ||
|
||
PartitionedTypeSpecification() : base(NotHappy.Default) {} | ||
} | ||
|
||
sealed class NotHappy : ISpecification<TypeInfo> | ||
// HACK: This is a bit of a hack -- ok a total hack, to pass a test for .NET Framework under special conditions: https://github.com/ExtendedXmlSerializer/home/issues/248 | ||
// This doesn't occur for .NET Core, but we will have to do better for v3 in any case. | ||
{ | ||
public static NotHappy Default { get; } = new NotHappy(); | ||
|
||
NotHappy() : this(typeof(object).Assembly) {} | ||
PartitionedTypeSpecification() : this(typeof(object).Assembly) {} | ||
|
||
readonly Assembly _assembly; | ||
|
||
public NotHappy(Assembly assembly) => _assembly = assembly; | ||
public PartitionedTypeSpecification(Assembly assembly) => _assembly = assembly; | ||
|
||
// HACK: This is a bit of a hack -- ok a total hack, to pass a test for .NET Framework under special conditions: | ||
// https://github.com/ExtendedXmlSerializer/home/issues/248 | ||
public bool IsSatisfiedBy(TypeInfo parameter) | ||
=> parameter.Assembly != _assembly || !parameter.Namespace.Contains("System.Runtime.Remoting"); | ||
=> parameter.Assembly != _assembly || (!parameter.Namespace?.Contains("System.Runtime.Remoting") ?? true); | ||
} | ||
} |