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)
-
1
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.
-
0
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; }
-
1
Hi @lukasz.storka
You can check https://support.aspnetzero.com/QA/Questions/3598#answer-7075feda-9910-471a-93e1-7a28f9892821 about virtual properties.