none
How to Handle Abstraction with EF? RRS feed

  • Question

  • Hi,

    I am currently working on a project, where I want to completely isolate data management and usage.
    For this purpose I have a "Repository" that delivers only interfaced types like:
       Entity Car -> ICar = Repository.GetCar(<....>);

    In general this would work, by just providing a partial class "car" that realizes the ICar Interface, but....

    I also have a Entity Wheel, again with partial class realizing IWheel. The problem now is, that the entity "Car" as a association with "Wheel". Now I need to extend my ICar interface to also have "List<IWheel>" property which then of course needs to be provided by the Car entity. Unforutnately the EF-Entity does not know of "ICar". How can this dilemma be solved?

    Thanks for any help and hints!

    Regards
    Rainer

    Tuesday, April 16, 2013 1:47 PM

Answers

  • Hi Chester,

    thank you for your effort.

    Your suggestion worked but now I have the next problem. Cascaded Delete does not work any more. I think I need to switch to "code first" in my EF-Model. This way I hope I get better control over my entities...

    Regards
    Rainer

    • Marked as answer by Rainer Queck Friday, April 19, 2013 6:17 AM
    Thursday, April 18, 2013 9:22 AM

All replies