EasyAbp / Abp.DynamicEntity

An ABP module that can dynamically create entities at runtime and perform CRUD operations like normal entities
50 stars 8 forks source link

[Question] Does this work with odata API? #6

Open sNakiex opened 2 years ago

sNakiex commented 2 years ago

Will the dynamic entity(s) show up in the EDM out of the box? Or is there additional work required?

hueifeng commented 2 years ago

Hello, I am late and have not done any operation for the EDM of OData.

private static IEdmModel GetEdmModel()
{
  var builder = new ODataConventionModelBuilder();
  builder.EntitySet<Book>("Books");
  return builder.GetEdmModel();
}
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
  <edmx:DataServices>
    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Default">
      <EntityType Name="Book">
        <Key>
          <PropertyRef Name="Id"/>
        </Key>
        <Property Name="Id" Type="Edm.Int32" Nullable="false"/>
      </EntityType>
      </EntityContainer>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>

As shown above, what you said way of EDM is introduced into?

sNakiex commented 2 years ago

Hello, let me try to clarify. Let's say the Book entity is a dynamic entity. Just like the computer entity in your sample project. It would be really sweet if you could use that computer model in the API just like a regular model. So you could create add a new computer to the database by doing a post to /api/Computer

gdlcf88 commented 2 years ago

Hi @sNakiex, the DynamicEntity module doesn't have separated HTTP APIs for each entity.

DynamicEntityAppService provides unified APIs for them.

But I'm sure you'll be interested in the EntityUi module, which provides real-time generated CRUD pages. It supports traditional entities and dynamic entities.

See: https://github.com/EasyAbp/Abp.EntityUi

sNakiex commented 2 years ago

Sorry for the late response, I haven't really had a lot of free time ^^ Would it be worthwhile to invest some time into researching if this is possible?