Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. Domain Driven Design and Persistance. How do you do it?

Domain Driven Design and Persistance. How do you do it?

Scheduled Pinned Locked Moved Design and Architecture
designquestiondiscussion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fabio Franco
    wrote on last edited by
    #1

    I am interested in knowing how you design your Domain Model and its persistance layer. Particularly I design the Domain Model completely independent from any other logical application layer. As a matter of fact, it is oblivious of any other logical layer. In that case I do create a service layer that acts as a proxy and sends domain model objects to the persistence layer. I've seen Dependency Injection/IoC to perform the persistence, having the interface defined in the Domain Model, but I never really liked this approach, because it creates a small dependence of interface implementation by the persistence layer. Do you have "Save" methods on your Domain Objects? I'd appreciate if you shared your thoughts.

    To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

    B K 2 Replies Last reply
    0
    • F Fabio Franco

      I am interested in knowing how you design your Domain Model and its persistance layer. Particularly I design the Domain Model completely independent from any other logical application layer. As a matter of fact, it is oblivious of any other logical layer. In that case I do create a service layer that acts as a proxy and sends domain model objects to the persistence layer. I've seen Dependency Injection/IoC to perform the persistence, having the interface defined in the Domain Model, but I never really liked this approach, because it creates a small dependence of interface implementation by the persistence layer. Do you have "Save" methods on your Domain Objects? I'd appreciate if you shared your thoughts.

      To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

      B Offline
      B Offline
      bakary konate
      wrote on last edited by
      #2

      Hi, If you are using relational database system like MySQL, Oracle, consider using an Object-Relational Mapping framework(ORM) that implements Data Acess Layer(DAL) design pattern . TopLink, Hibernate, ADO.Net, Java JPA, just to name a few, are popular ORM Frameworks. These frameworks abstract DBMS access and handle all database CRUD for you, and do much more. For example using Java JPA, you would save a domain object as follow: EntityManager em; em.persist(BookDTO);// BookDTO is the object to be saved in you database. BookDTO must be annotated as an Entity( @Entity) as far as JPA is concern. You can apply Dependency Injection/IoC to inject the EntityManager in your component. To use DAL patern organize your Domain Model into Business Object(BO) and Data Transfer Object(DTO), and utilize an ORM framework of your choice.

      Bakary Konate

      1 Reply Last reply
      0
      • F Fabio Franco

        I am interested in knowing how you design your Domain Model and its persistance layer. Particularly I design the Domain Model completely independent from any other logical application layer. As a matter of fact, it is oblivious of any other logical layer. In that case I do create a service layer that acts as a proxy and sends domain model objects to the persistence layer. I've seen Dependency Injection/IoC to perform the persistence, having the interface defined in the Domain Model, but I never really liked this approach, because it creates a small dependence of interface implementation by the persistence layer. Do you have "Save" methods on your Domain Objects? I'd appreciate if you shared your thoughts.

        To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

        K Offline
        K Offline
        Keld Olykke
        wrote on last edited by
        #3

        Hi, At work I have created a homebrew framework ColdBlood with various object oriented design features; one is persistency. In the specification (interface) of each object type we differ between properties, references, child and children. We do this using different attributes (in C#). A property can have the optional flag Persistent enabled, which means this property is serializable. All the specification attributes are compiled into some info classes for fast lookup e.g. by the serializer/deserializer. This design means a complete separation of persistency specification and serializer/deserializer implementation. Currently, we use a serializer/deserializer implementation with multiple ToBytes and FromBytes methods. The resulting byte data can be transfered to/from files or sockets. Kind Regards, Keld Ølykke

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups