Start a new topic
Answered

Create new entities

Hello everybody!


I need your help in order to change some entities... Indeed I want to create a new entity but I don't know exactly how to do it!


Which are the files I have to change in order to do that? How the mapping beetween the database and the entity will be done?


I've seen that the mapping is done via the modelbuilder but I've failed to figure out how it works.


Thank you in advance for your help.


Romain


Best Answer

Hi Romain,


sorry for late response. Somehow we missed it.


In reality you don't have to create new entity, you can reuse existing catalog structure to create Album, for instance you can create them as a Package type in catalog named "Albums". That way you can reuse the whole API without any modifications. If however you'd like to create a new entity, simply create a new model just like we create for the catalog. The create a Repository for that model, again use either EFInventoryRepository as an example. 


Let me know if you have more questions.

Sasha. 


Answer

Hi Romain,


sorry for late response. Somehow we missed it.


In reality you don't have to create new entity, you can reuse existing catalog structure to create Album, for instance you can create them as a Package type in catalog named "Albums". That way you can reuse the whole API without any modifications. If however you'd like to create a new entity, simply create a new model just like we create for the catalog. The create a Repository for that model, again use either EFInventoryRepository as an example. 


Let me know if you have more questions.

Sasha. 

I'm gonna explain what I want to do!


I want that each customer has albums. Each album would be able to store photos. The website would not sale products but services where each service would be linked with an album.


I know that I can use LineItemOption in order to link an album with the service bought (I have already done it). But the customer will be able to add, delete, modify album so I think that I have to create a new model in the core.


I have already done something (copy/paste a model and change it) but I really don't understand how to be sure that the model is linked with the database... If someone could help me it would be very appreciated.


I don't know if it's important but in my album there will be: AlbumId, Name, DateCreation and UserId (because each album has an user and each user can have several albums)


Thank you.


Romain

Login or Signup to post a comment