Search code examples
c#codefluent

codefluent prevent get for property


I have two entities:

  1. categories
  2. products

And There is a 1:n relationship between them so I can get all products in a category by: Category.Products However, I don't want this property to exist. This, because the category is chached and if i load the products this way they wil also remain in the cache.

I can load the products by ProductCollection.LoadByCategpory and that is fine.

How can I prevent the property Products to be part of a Category? I assumed setting 'Hasget' to false would do the trick but it does not.


Solution

  • You want to set the IsModel property to false on the entity property "Products". It means "model" layer producers (as opposed to "persistence" layer producers) should not declare this property. Note this is only partially supported, as it can have side effects on other producers, so make sure it works well in your context.

    enter image description here