Skip to content

Replace obsolete AssociationAttribute with new EntityAssociationAttribute on client #509

Merged
Daniel-Svensson merged 14 commits intoOpenRIAServices:mainfrom
Daniel-Svensson:associationAttribute
Jun 9, 2024
Merged

Replace obsolete AssociationAttribute with new EntityAssociationAttribute on client #509
Daniel-Svensson merged 14 commits intoOpenRIAServices:mainfrom
Daniel-Svensson:associationAttribute

Conversation

@Daniel-Svensson
Copy link
Member

@Daniel-Svensson Daniel-Svensson commented Jun 9, 2024

Replace obsolete AssociationAttribute with new EntityAssociationAttribute on client

  • The client now uses EntityAssociationAttribute internally for all logic
  • The old AssociationAttribute is still discovered and mapped to an EntityAssociationAttribute in case an old version of the code generation has been used.
  • Code generation has been updated to generate EntityAssociationAttribute instead of AssociationAttribute

PR Classification

This pull request involves an API change, specifically replacing the AssociationAttribute class with the EntityAssociationAttribute class across several files.

PR Summary

The pull request primarily focuses on the transition from AssociationAttribute to EntityAssociationAttribute in the codebase.

  • A new EntityAssociationAttribute.cs file has been added, defining the new class used to mark an Entity member as an association.
  • The AssociationAttribute class has been replaced with the EntityAssociationAttribute class in multiple files including ChangeSetBuilder.cs, Entity.cs, EntityCollection.cs, EntityRef.cs, EntitySet.cs, MetaMember.cs, and IEntityCollection.cs.
  • In MetaMember.cs, the AssociationAttribute property has been replaced with the EntityAssociationAttribute property, with added logic to handle the transition.
  • The AttributeGeneratorHelper.cs file in OpenRiaServices.Tools.TextTemplate has been updated to translate all AssociationAttribute to EntityAssociationAttribute on the client.
  • A new EntityAssociationAttributeBuilder.cs file has been added in the OpenRiaServices.Tools namespace, defining a custom attribute builder for EntityAssociationAttribute instances.

@Daniel-Svensson Daniel-Svensson changed the title Use own EntityAssociationAttribute instead of obsolete AssociationAttribute on client Replace obsolete AssociationAttribute with new EntityAssociationAttributeon client Jun 9, 2024
@Daniel-Svensson Daniel-Svensson changed the title Replace obsolete AssociationAttribute with new EntityAssociationAttributeon client Replace obsolete AssociationAttribute with new EntityAssociationAttribute on client Jun 9, 2024
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 9, 2024

// that takes string arguments in constructor insterad of Arrrays as EntityAssociationAttribute does
else if (typeof(T) == typeof(string) && ctorArg.ArgumentType.IsArray)
{
value = (T)(object)string.Join(", ", ((IEnumerable<CustomAttributeTypedArgument>)ctorArg.Value).Select(arg => arg.Value?.ToString() ?? "null"));

Check warning

Code scanning / CodeQL

Useless upcast

There is no need to upcast from [String](1) to [Object](2) - the conversion can be done implicitly.
@Daniel-Svensson Daniel-Svensson linked an issue Jun 9, 2024 that may be closed by this pull request
@Daniel-Svensson Daniel-Svensson merged commit 6293d33 into OpenRIAServices:main Jun 9, 2024
@Daniel-Svensson Daniel-Svensson deleted the associationAttribute branch June 9, 2024 21:25
@Daniel-Svensson Daniel-Svensson added this to the 5.5.0 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

association attribute is obsolete

1 participant