Skip to content

Commit

Permalink
Allow control the source of field in portal indiv. (#211)
Browse files Browse the repository at this point in the history
Co-authored-by: korpinz <45260016+korpinz@users.noreply.github.com>
  • Loading branch information
jakSolutionsGithub and korpinz committed Jun 5, 2023
1 parent d673917 commit f3402ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/FMData.Rest/FileMakerRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,23 @@ private static T ConvertJTokenToInstance<T>(Func<T, int, object> fmId, Func<T, i
{
foreach (var jp in jo.Properties().ToList())
{
if (jp.Name.Contains(portalDataAttr.TablePrefixFieldNames + "::"))
if (portalDataAttr.SkipPrefix)
{
jo.Add(jp.Name.Replace(portalDataAttr.TablePrefixFieldNames + "::", ""), jp.Value);
jo.Remove(jp.Name);
int index;
if (jp.Name.Contains("::"))
{
index = jp.Name.IndexOf(':') + 2;
jo.Add(jp.Name.Replace(jp.Name.Substring(0, index), ""), jp.Value);
jo.Remove(jp.Name);
}
}
else
{
if (jp.Name.Contains(portalDataAttr.TablePrefixFieldNames + "::"))
{
jo.Add(jp.Name.Replace(portalDataAttr.TablePrefixFieldNames + "::", ""), jp.Value);
jo.Remove(jp.Name);
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/FMData/PortalDataAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public class PortalDataAttribute : System.Attribute
/// </summary>
public string TablePrefixFieldNames { get; set; }

/// <summary>
/// Allow to control the source of each field in the portal individually
/// </summary>
public bool SkipPrefix { get; set; }

/// <summary>
/// Constructor for Attribute
/// </summary>
Expand Down

0 comments on commit f3402ee

Please sign in to comment.