From 6392e072f81c128f0642e7b1ad954afbf96a0d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20Akko=C3=A7?= Date: Mon, 19 Jun 2017 22:38:49 +0300 Subject: [PATCH] Update MetadataProvider.cs remove if properties or their types has got ExcludeProxy Attribute (or dummy name) --- WebApiProxy.Server/MetadataProvider.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WebApiProxy.Server/MetadataProvider.cs b/WebApiProxy.Server/MetadataProvider.cs index d91681b..d02d196 100644 --- a/WebApiProxy.Server/MetadataProvider.cs +++ b/WebApiProxy.Server/MetadataProvider.cs @@ -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 + ).ToArray(); // Clear and Nice :) + + model.Properties = from property in properties select new ModelProperty {