-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #465 from PHOENIXCONTACT/fix/instatiate-default-va…
…lues Add DefaultValue handling for Instatiate resources for MORYX 8
- Loading branch information
Showing
6 changed files
with
72 additions
and
16 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/Moryx.AbstractionLayer.Resources.Endpoints/DataMemberAttributeValueProviderFilter.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,26 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.Reflection; | ||
using System.Runtime.Serialization; | ||
using Moryx.Configuration; | ||
|
||
namespace Moryx.AbstractionLayer.Resources.Endpoints | ||
{ | ||
internal class DataMemberAttributeValueProviderFilter : IValueProviderFilter | ||
{ | ||
private readonly bool _filterDataMembers; | ||
|
||
public DataMemberAttributeValueProviderFilter(bool filterDataMembers) | ||
{ | ||
_filterDataMembers = filterDataMembers; | ||
} | ||
|
||
public bool CheckProperty(PropertyInfo propertyInfo) | ||
{ | ||
if (_filterDataMembers) | ||
return propertyInfo.GetCustomAttribute<DataMemberAttribute>() == null; | ||
return propertyInfo.GetCustomAttribute<DataMemberAttribute>() != null; | ||
} | ||
} | ||
} |
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
2 changes: 2 additions & 0 deletions
2
src/Moryx.Resources.Management/Resources/DataMemberAttributeValueProviderFilter.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
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