odata.net icon indicating copy to clipboard operation
odata.net copied to clipboard

CodeGen support for emitting dynamic properties on open types

Open BerserkerDotNet opened this issue 5 years ago • 5 comments

Issues

This pull request fixes issue #1398.

Description

Modified OData client generator T4 templates to generate a dictionary for OpenType types. For example, for the following CSDL:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:DataServices>
    <Schema Namespace="OpenTypeRepro" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <ComplexType Name="MyOpenType" OpenType="true" />
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>

The proxy will conatain DynamicProperties property:

        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "7.5.1")]
        [global::Microsoft.OData.Client.OriginalNameAttribute("")]
        public global::System.Collections.Generic.Dictionary<string, object> DynamicProperties
        {
            get
            {
                return this._DynamicProperties;
            }
            set
            {
                this.OnDynamicPropertiesChanging(value);
                this._DynamicProperties = value;
                this.OnDynamicPropertiesChanged();
                this.OnPropertyChanged("");
            }
        }
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "7.5.1")]
        private global::System.Collections.Generic.Dictionary<string, object> _DynamicProperties = new global::System.Collections.Generic.Dictionary<string, object>();
        partial void OnDynamicPropertiesChanging(global::System.Collections.Generic.Dictionary<string, object> value);
        partial void OnDynamicPropertiesChanged();

BerserkerDotNet avatar Mar 29 '19 00:03 BerserkerDotNet

CLA assistant check
All CLA requirements met.

msftclas avatar Mar 29 '19 00:03 msftclas

@BerserkerDotNet Thanks for your contribution. The following test cases are failing - image

KanishManuja-MS avatar Apr 05 '19 16:04 KanishManuja-MS

Hi, any updates on this issue?

aboryczko avatar May 17 '19 07:05 aboryczko

@BerserkerDotNet Hi, Is there any updates?

madansr7 avatar Aug 21 '19 20:08 madansr7

@BerserkerDotNet , we would like to pick this up in our next release of client code gen. Could you please rebase and add the requested tests. Let us know if you have any questions or concerns.

madansr7 avatar Sep 04 '19 20:09 madansr7