Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion WebApiProxy.Server/MetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,14 @@ private void AddModelDefinition(Type classToDef)
var properties = classToDef.IsGenericType
? classToDef.GetGenericTypeDefinition().GetProperties()
: classToDef.GetProperties();


// remove if properties or their types has got ExcludeProxy Attribute (or dummy name)
properties = properties.Where(x =>
!x.CustomAttributes.Any(z => z.AttributeType.Name.Contains("ExcludeProxy")) && // Property
!x.PropertyType.CustomAttributes.Any(y => y.AttributeType.Name.Contains("ExcludeProxy")) // Type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid magic strings where possible.

An idea is to either compare to nameof(ExcludeProxy) or just compare where types contain typeof(ExcludeProxy)

).ToArray(); // Clear and Nice :)


model.Properties = from property in properties
select new ModelProperty
{
Expand Down