none
Does EF proxy classes override primitive properties? RRS feed

  • Question

  • I'm reading this article about EF proxy classes, but it's still unclear to me what is actually overridden.

    Is there a clear list of this?


    Shimmy

    Wednesday, October 14, 2015 1:10 AM

Answers

  • Hello,

    >>Does the proxy classes interfere with this property and override this, or I can trust my behavior to work consistently?

    No, it will not override this property.

    >>I want this property to be saved to DB for indexing and searching purposes, but I want it to be calculated on the application.

    With your code, it could be calculated on the application, however, it could not be able to saved into DB because it is marked as the “Proetcted” access level and cannot be set in app.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 14, 2015 8:38 AM
    Moderator

All replies

  • Hello Shimmy,

    >>Does EF proxy classes override primitive properties?

    For these primitive properties, the proxy subclass would inherit them.

    The proxy represents an instance which has not been populated with data from the database yet, but only knows its own ID and proxies are typically created when you have a relationship property between two entities which is lazily loaded.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 14, 2015 3:09 AM
    Moderator
  • For these primitive properties, the proxy subclass would inherit them.

    Hi Fred and thanks for your quick response,

    My question was if the primitive properties are overridden, I know they're inherited.

    Consider this property:

    public int TotalAmount
    {
      get
      {
        return SaleAmount - Tax;
      }
      protected set
      {
        /* leave empty */
      }
    }

    Does the proxy classes interfere with this property and override this, or I can trust my behavior to work consistently?

    I want this property to be saved to DB for indexing and searching purposes, but I want it to be calculated on the application.


    Shimmy

    Wednesday, October 14, 2015 3:44 AM
  • Hello,

    >>Does the proxy classes interfere with this property and override this, or I can trust my behavior to work consistently?

    No, it will not override this property.

    >>I want this property to be saved to DB for indexing and searching purposes, but I want it to be calculated on the application.

    With your code, it could be calculated on the application, however, it could not be able to saved into DB because it is marked as the “Proetcted” access level and cannot be set in app.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 14, 2015 8:38 AM
    Moderator