Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to Get Entity by Enum Property in Project.Core #1346


User avatar
0
kacey created

I discovered ABP a few days ago After searching for tools to help my Enterprise Application Development. I went through the samples and documentation and realized I just found what I needed. The N-layered structure and the DDD model is amazing. Even though I don't have so much experience in that area, ABP has brought me up to speed a bit.

My question based on the topic is how to write a method to get an entity by an enum property through (IRepository) as used in the samples. I thought of using DB contexts but I think it goes against the best practices as I didn't see you do that in your samples.

With a model A, Having an Enum property, and another model B in which the enum property of A is a a foreign key, I would want to set that field in B's constructor so when creating a new entity, it is automatically added. My problem is where and how to write the method (GetByEnum) that will help me achieve what I want.

I hope you understand my question. Thanks.


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I coludn't understand the situation very well but you can try custom repositories <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/EntityFramework-Integration#DocCustomRepositoryMethods">http://www.aspnetboilerplate.com/Pages/ ... oryMethods</a>.

    If you can explain with real entities, I can think about it again.

  • User Avatar
    0
    kacey created

    Hi,

    Thanks for your response. While waiting for a response to my questions, I figured it out after several of hours of trials and studying the framework several times over. However, I'm now stuck with triggering events (email notifications) through EventBus For changes with some entities. I guess my issue is implementing an email service to handle the notification events. I didn't see clear examples to guide me in the documents on the website. You think you can put me through or I would have to create a fresh thread for this question?

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Entity events are automatically triggered actually. Please see Entity Changes section of documentation <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events">http://aspnetboilerplate.com/Pages/Docu ... ain-Events</a>.

    You can take a look at UserAccountSynchronizer class for example <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/1c77cfe842f81170f4ce7e10036c1e8784331dc6/src/Abp.Zero/Authorization/Users/UserAccountSynchronizer.cs">https://github.com/aspnetboilerplate/mo ... ronizer.cs</a>