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

Filtering in GetAll method by Navigation Property #6003


User avatar
0
lukasz.storka created

Using Power Tools I have generated an entity Post which has a Navigation Property TopicId to a Topic entity. Now that also generated PostsAppService with method GetAll, where I can do some filtering of the posts. What I find strange is that in this method I can not filter by TopicId, but TopicTitle - did I made something wrong here? That is strange for me, because in the post entity I can see two properties: public virtual long TopicId and public Topic Topic, so I would expect that I can filter by parent Id, not name. Second question is regarding those properites - why TopicId is virtual and not Topic? I would expect that Post entity should have always filled the TopicId, but Topic only when it is needed.

Thanks! Lukasz


3 Answer(s)
  • User Avatar
    1
    yekalkan created

    What I find strange is that in this method I can not filter by TopicId, but TopicTitle - did I made something wrong here?

    No, you didn't do anything wrong. That is what rad tool generates. You can modify it, if you like.

  • User Avatar
    0
    lukasz.storka created

    OK, just wanted to know, if there is a way to generate it automatically with this filtering by id. And regarding that virtual properties - shouldn't that be generated the other way around?

    Like: public int TopicId { get; set; } publica virtual Topic Topic { get; set; }

  • User Avatar
    1
    ismcagdas created
    Support Team