Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Commerce forum / Getting Error as The e...
Commerce forum

Getting Error as The entity does not have a key defined while generating typescript proxy

(0) ShareShare
ReportReport
Posted on by 392

Hi Everyone,

Hope all are doing well.

I am trying generate typescript proxy using commerceproxy generator but it throws error "Commerce Proxy Generator failed due to the error: The entity 'SuspendedTransaction' does not have a key defined..".

I have defined the key inside the entity.

Can anyone please tell me, how to resolve the error?

0513.pastedimage1567070472330v1.png

  • Gozie Ifediora Profile Picture
    Gozie Ifediora 85 on at
    RE: Getting Error as The entity does not have a key defined while generating typescript proxy

    Hi Pankaj,

    Could you please share how you resolved this issue? I am facing the same problem. I am also using a custom entity and the key attribute has been specified for one of the data members. I get this error when trying to compile my RetailProxy project and when trying the access the retail server via IIS Express. 

    Thanks.

  • Pankaj_93 Profile Picture
    Pankaj_93 392 on at
    RE: Getting Error as The entity does not have a key defined while generating typescript proxy

    Hi Oksana,

    Thanks for your response....

    Now I am able to generate the proxy class.

  • Pankaj_93 Profile Picture
    Pankaj_93 392 on at
    RE: Getting Error as The entity does not have a key defined while generating typescript proxy

    Hi Oksana,

    Thanks for your reply...

    Basically this issue is fixed some how...

    I am getting below error while generating the proxy class. In my reference folder this dll is present with 5.7.0.0 version, still getting error.

    Loading core metadata from assembly file C:\Users\Adminb7a0354d41\Desktop\RetailSDK\References\Microsoft.Dynamics.Retail.Proxies.ExtensionsGenerator.9.17.19329.14\build\Microsoft.Dynamics.Retail.RetailServerLibrary.dll.

    Loading extended metadata from assembly file C:\Users\Adminb7a0354d41\Desktop\RetailSDK\References\POS.CustomerEx.Extension.dll.

    Commerce Proxy Generator failed due to the error: Could not load file or assembly 'System.Web.OData, Version=5.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.TypeExtensions.CallMethod(Type source, Object instance, String methodName, Object[] parameters)

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.MetadataResolver.LoadEdmxFromAssemblyFile(String filePath, IEnumerable`1 extendedAssemblyPaths, String apiVersion)

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.MetadataResolver.GetEdmxStringInternal(String metadataPath, Collection`1 extendedMetadataPaths, String apiVersion)

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.MetadataResolver.GetEdmxStringInternal(String metadataPath, Collection`1 extendedMetadataPaths, String apiVersion)

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.MetadataResolver.GetEdmxString(String metadataPath, Collection`1 extendedMetadataPaths, String apiVersion)

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.StartUp.Start(String[] args)

      at Microsoft.Dynamics.Commerce.CommerceProxyGenerator.Program.Main(String[] args)

  • Oksana Kovaliova Profile Picture
    Oksana Kovaliova 3,597 on at
    RE: Getting Error as The entity does not have a key defined while generating typescript proxy

    Hi, if you can share how your C# classes look like (for which you generate proxies) - we can check what can be wrong

  • Pankaj_93 Profile Picture
    Pankaj_93 392 on at
    RE: Getting Error as The entity does not have a key defined while generating typescript proxy

    Hi Oksana,

    Hope you are doing well.

    Suspended transaction is our custom entity. I have defined the primary key. I tried to generate the typescript proxy of the "StoreHourSample" project. It is also throwing the same error.

    If possible, please share any sample.

  • Oksana Kovaliova Profile Picture
    Oksana Kovaliova 3,597 on at
    RE: Getting Error as The entity does not have a key defined while generating typescript proxy

    Hi, is SuspendedTransaction your custom entity?

    As soon as you define any OData new entity, you should also define primary key on some of its fields using 'Key' attribute. If your entity does not have natural primary key, most probably you need to use complex type instead of using the entity.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,602 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,340 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans